/ SeriousOJ /

Record Detail

Compile Error

foo.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.

Code

#include<bits/stdc++.h>
#define endl        '\n'
#define F           first
#define S           second
#define pb          push_back
#define yes         cout<<"YES\n"
#define no          cout<<"NO\n"
#define all(x)      x.begin(),x.end()
#define allr(x)     x.rbegin(),x.rend()
#define error1(x)   cerr<<#x<<" = "<<(x)<<endl
#define error2(a,b) cerr<<"("<<#a<<", "<<#b<<") = ("<<(a)<<", "<<(b)<<")\n";
#define coutall(v)  for(auto &it: v) cout << it << " "; cout << endl;
using namespace std;
using ll = long long;
using ld = long double;

short OK(ll n, vector<ll> v, bool xx, bool xx2) {
    short op1 = -1, op2 = -1;
    bool op = 1;
    for(int i = 0; i < n; i++) {
        // cout << i << " => " << op1 << " " << op2 << endl;
        if(op) {
            if(op1 == -1) {
                if(xx == 1) {
                    if(v[1] == 0) {
                        return -1;
                    }
                    op1 = 1;
                    v[1] -= 1;
                }
                else {
                    if(v[0] == 0) {
                        return -1;
                    }
                    op1 = 0;
                    v[0] -= 1;
                }
            }
            else {
                op1 ^= 1;
                if(v[op1] == 0) {
                    return 0;
                }
                v[op1] -= 1;
            }
        }
        else {
            if(op2 == -1) {
                if(xx2 == 1) {
                    if(v[1] == 0) {
                        return -1;
                    }
                    op2 = 1;
                    v[1] -= 1;
                }
                else {
                    if(v[0] == 0) {
                        return -1;
                    }
                    op2 = 0;
                    v[0] -= 1;
                }
            }
            else {
                op2 ^= 1;
                if(v[op2] == 0) {
                    return 1;
                }
                v[op2] -= 1;
            }
        }
        op ^= 1;
        // cout << i << " => " << op1 << " " << op2 << endl;
    }
    if(!op) return 1;
    else return 0;
}

void solve() {
    ll n;
    cin >> n;
    vector<ll> v(2);
    for (int i = 0; i < n; i++) {
        ll x; cin >> x;
        v[x & 1] += 1;
    }
    if(OK(n, v, 0, 0) == 1 or OK(n, v, 0, 1) == 1 or OK(n, v, 1, 0) == 1 or OK(n, v, 1, 1) == 1) cout << "Roy" << endl;
    else cout << "Hridoy" << endl;
    return;
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int tc = 1;
    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case " << t << ": ";
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Contest
Brain Booster #6
Language
C99 (GCC 13.2.0)
Submit At
2024-10-03 17:34:24
Judged At
2024-10-03 17:34:24
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes