General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
78521764 Practice:
squalls
266B - 10 GNU C++11 Wrong answer on test 4 60 ms 12 KB 2020-04-30 01:50:35 2020-04-30 01:50:38
→ Source
// Your First C++ Program

#include <iostream>
#include <algorithm>
#include <math.h>
#include <bits/stdc++.h>
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define fill(x, y)     memset(x, y, sizeof(y))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;

const   int            inf = 0;
const   double         eps = 0;
const   int            ms  = 0;
const   int            md  = 0;
const int MOD = 1e9 + 7;
using namespace std;



ll binpow(ll a, ll b){
    if(b==0) return 1;
    if (b%2==1){
        return binpow(a, b - 1) * a % MOD;
    } else  {
        ll b2 = binpow(a, b / 2) % MOD;
        return b2 * b2 % MOD;
    }
}


void answer_case(){
    ll n = 0;
    ll element;
    cin >> n;
    int arr [n];

    ll temp_max = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> element;
        arr[i] = element;
        if (element > temp_max){
            temp_max = element;
        }
    }
    
    bool found = false;
    ll gap = 0;
    for (int i = 0; i < n; i++)
    {

        if(found){
            ll g = arr[i] - temp_max;
            if (g <  gap)
            {
                gap = g;
            }
        }
        if (arr[i] == temp_max){
            found = true;
        }
    }
    if(gap == 0){
        cout << 0 << endl;
    }
    else
    {
        ll need = ceil(log2(-1 * gap));
        cout << (need + 1) << endl;
    }

}

int main() {

    ll n;
    ll t;
    cin >> n >> t;
    char children[n];
    
    string instring ("");
    cin >> instring;

    for (int i = 0; i < n;i++){
        children[i] = instring.at(i);
    }
    for (int time = 0; time < t;time++){
        int i = 1;
        while (i < n)
        {
            if(children[i-1] == 'B' && children[i] == 'G'){
                // Let girl in front
                children[i] = 'B';
                children[i - 1] = 'G';
                i++;
            }
            i++;
        }
    }
    string s = children;
    cout << s;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details