Compile Error
foo.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int MODD = 998244353;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//
//template <typename num_t>
//using ordered_set = tree<num_t, null_type, less<num_t>, rb_tree_tag, tree_order_statistics_node_update>;
void solve(){
int n;
cin>>n;
int o=0,e=0;
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(x&1)o++;
else e++;
}
int r=1,rp=-1,hp=-1;
while(1){
if(r){
r=0;
if(rp==-1){
if(e>o and e){
e--;
rp=1;
}
else if(o>e and o){
o--;
rp=0;
}
else if(o){
o--;
rp=0;
}
else if(e){
e--;
rp=1;
}
else{
cout<<"Hridoy\n";
return;
}
}
else if(rp==0){
if(e){
e--;
rp=1;
}
else{
cout<<"Hridoy\n";
return;
}
}
else{
if(o){
o--;
rp=0;
}
else{
cout<<"Hridoy\n";
return;
}
}
}
else{
r=1;
if(hp==-1){
if(rp==1){
if(e){
e--;
hp=1;
}
else if(o){
o--;
hp=0;
}
else{
cout<<"Roy\n";
return;
}
}
else{
if(o){
o--;
hp=0;
}
else if(e){
e--;
hp=1;
}
else{
cout<<"Roy\n";
return;
}
}
}
else if(hp==0){
if(e){
e--;
hp=1;
}
else{
cout<<"Roy\n";
return;
}
}
else{
if(o){
o--;
hp=0;
}
else{
cout<<"Roy\n";
return;
}
}
}
}
cout<<"Roy\n";
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
int t = 1;
cin >> t;
//int T = 0;
while (t--)
{
//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:13:03
- Judged At
- 2024-11-11 02:46:33
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes