/ SeriousOJ /

Record Detail

Compile Error

foo.cc:5:10: fatal error: algo/debug.h: No such file or directory
    5 | #include "algo/debug.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.

Code

#include <iostream>
using namespace std;

#ifndef ONLINE_JUDGE
#include "algo/debug.h"
#else
#define debug(...) 42
#endif

bool can_win(int f_ev, int s_ev, int ev, int od) {
  int turn = 1;
  while (true) {
    if (turn) {
      if (f_ev) {
        ev--;
      } else
        od--;
      f_ev ^= 1;
    } else {
      if (s_ev) {
        ev--;
      } else
        od--;
      s_ev ^= 1;
    }
    turn ^= 1;
    if (ev < 0 || od < 0)
      return turn;
  }
}

void solve() {
  int n;
  cin >> n;
  int ev = 0, od = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    (x & 1) ? od++ : ev++;
  }
  debug(ev, od);
  bool ok = false;
  for (int i = 0; i < 2; i++) {
    int win = 0;
    for (int j = 0; j < 2; j++) {
      win += can_win(i, j, ev, od);
    }
    ok |= (win == 2);
  }
  cout << (ok ? "Roy" : "Hridoy") << '\n';
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--)
    solve();
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-03 20:52:46
Judged At
2024-11-11 02:44:24
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes