/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 12ms 576.0 KiB
#3 Accepted 6ms 576.0 KiB
#4 Accepted 6ms 580.0 KiB
#5 Accepted 20ms 952.0 KiB
#6 Accepted 20ms 948.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
using namespace std;

void solve() {

  int n; cin >> n;
  std::vector<int> a(n);
  int even = 0, odd = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    if(a[i] & 1) 
      odd++;
    else
      even++; 
  }
  if(odd > even) 
    swap(odd, even);
  bool check = 0;
  if(n == 1) 
    check = 1;
  else if(n == 2)
    check = 0;
  else if(even == odd) 
    check = 0;
  else if(odd == 0 or even == 0)
    check = 0;
  else if(odd & 1)
    check = 1;
  else 
    check = (odd + 1 == even);
  cout << (check ? "Roy\n" : "Hridoy\n");

}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int t = 1; 
    cin >> t;  
    for (int i = 1; i <= t; i++) {
        solve();  
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-04 19:10:08
Judged At
2024-11-11 02:42:12
Judged By
Score
100
Total Time
20ms
Peak Memory
952.0 KiB