/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 12ms 592.0 KiB
#3 Accepted 6ms 572.0 KiB
#4 Accepted 6ms 532.0 KiB
#5 Accepted 19ms 948.0 KiB
#6 Accepted 20ms 832.0 KiB

Code

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
using ll = long long;

int main() {
  FAST;
  
  int tc = 1, ti;
  cin >> tc;

  for (ti = 1; ti <= tc; ++ti) {
    int n, i, p, x, y;
    cin >> n;

    vector<int> a(n);
    x = y = 0;
    for (i = 0; i < n; ++i) {
      cin >> p;
      if (p & 1) x += 1;
        else y += 1;
    }
    if (x > y) swap(x, y);

    bool roy = 0;
    if (n == 1) {
      roy = 1;
    } else if (n == 2) {
      roy = 0;
    } else if (x == 0) {
      roy = 0;
    } else if (x == y) {
      roy = 0;
    } else if (x & 1) {
      roy = 1;
    } else {
      roy = (y == x+1);
    }

    cout << (roy ? "Roy" : "Hridoy") << "\n";
  }

  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:23:56
Judged At
2024-12-17 11:32:54
Judged By
Score
100
Total Time
20ms
Peak Memory
948.0 KiB