/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Wrong Answer 12ms 576.0 KiB
#3 Wrong Answer 6ms 324.0 KiB

Code

#include <bits/stdc++.h>
#include <cmath>
#include <bitset>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>pbds;
#define ll  long long  int
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define    gcd(a,b)         __gcd(a,b)
#define    lcm(a,b)        ((a*b)/gcd(a,b))
#define    pi               acos(-1.00)
const ll mod=1000000007;
 
void evan(int t) {
 ll n;cin>>n;
 ll a[n];
 ll od=0,ev=0;
 for(int i=0;i<n;i++){cin>>a[i];
 if(a[i]%2==0)ev++;
 else od++;
 }
 ll odd=od;
 ll even=ev;
 ll r_i=0,h_i=1;
 if(odd>0&&even>0){while(1){
  if(r_i==0){
      if(even<1)break;
      even--;
      r_i=1;
  }
  else{
        if(odd<1)break;
      odd--;
      r_i=0;
  }
  if(h_i==0){
    if(even<1){cout<<"Roy\n";return;}
      even--;
      h_i=1;
  }
  else{
    if(odd<1){cout<<"Roy\n";return;}
      odd--;
      h_i=0;
  }
 }}
 odd=od;
  even=ev;
  r_i=1,h_i=0;
 if(odd>0&&even>0){while(1){
  if(r_i==0){
      if(even<1)break;
      even--;
      r_i=1;
  }
  else{
        if(odd<1)break;
      odd--;
      r_i=0;
  }
  if(h_i==0){
    if(even<1){cout<<"Roy\n";return;}
      even--;
      h_i=1;
  }
  else{
    if(odd<1){cout<<"Roy\n";return;}
      odd--;
      h_i=0;
  }
 }}
 odd=od;
  even=ev;
  r_i=1,h_i=1;
 if(odd>1){
     while(1){
  if(r_i==0){
      if(even<1)break;
      even--;
      r_i=1;
  }
  else{
        if(odd<1)break;
      odd--;
      r_i=0;
  }
  if(h_i==0){
    if(even<1){cout<<"Roy\n";return;}
      even--;
      h_i=1;
  }
  else{
    if(odd<1){cout<<"Roy\n";return;}
      odd--;
      h_i=0;
  }
 }
 }
 odd=od;
  even=ev;
  r_i=0,h_i=0;
 if(even>1){
     while(1){
  if(r_i==0){
      if(even<1)break;
      even--;
      r_i=1;
  }
  else{
        if(odd<1)break;
      odd--;
      r_i=0;
  }
  if(h_i==0){
    if(even<1){cout<<"Roy\n";return;}
      even--;
      h_i=1;
  }
  else{
    if(odd<1){cout<<"Roy\n";return;}
      odd--;
      h_i=0;
  }
 }
 }
 cout<<"Hridoy\n";
}
signed main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(nullptr);
    ll t=1; cin>>t;
     for(int i=1;i<=t;i++){ 
         evan(i);
       }
}

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Contest
Brain Booster #6
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 16:09:37
Judged At
2024-11-11 02:49:09
Judged By
Score
1
Total Time
12ms
Peak Memory
576.0 KiB