/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 32ms 592.0 KiB
#3 Wrong Answer 11ms 444.0 KiB

Code

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <limits>
#include <cstring>
using namespace std;

void solve() {

  int n; cin >> n;
  std::vector<int> a(n);
  int ev = 0, od = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    if(a[i] & 1) {
      od++;
    } else {
      ev++;
    }
  }
  if(n == ev or n == od) {
    cout << "Hridoy" << endl;
    return;
  }
  if(ev == od) {
    cout << "Hridoy" << endl;
    return;
  }
  if(ev > od and n % 2 == 0) {
    cout << "Hridoy" << endl;
    return;
  }
  if(ev > od and n & 1) {
    cout << "Roy" << endl;
    return;
  }
  if(od > ev and n % 2 == 0) {
    cout << "Hridoy" << endl;
    return;
  }
  if(od > ev and n & 1) {
    cout << "Roy" << endl;
    return;
  }
  
}

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
Contest
Brain Booster #6
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 17:00:50
Judged At
2024-12-17 11:33:30
Judged By
Score
1
Total Time
32ms
Peak Memory
592.0 KiB