General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
96833885 Practice:
Sperata
266B - 10 GNU C++11 Wrong answer on test 6 30 ms 0 KB 2020-10-27 10:15:28 2020-10-27 10:15:28
 
 
→ Source
#include <iostream>
#include <string.h>

using namespace std;
int main(){

    int a,n;
    cin>>a>>n;
     string s;
     cin>>s;
    // declaring character array
    char char_array[a + 1];

    // copying the contents of the
    // string to char array
    strcpy(char_array, s.c_str());
    int x=0;
    while(x<n)
    {
    for (int i = 0; i < a-1; i++)
        {
            if (char_array[i]!='G')
            {
             swap(char_array[i],char_array[i+1]);
             i++;
            }
        }
    x++;
    }
     for (int i = 0; i < a; i++)
        cout << char_array[i];
    return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details