/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 30ms 568.0 KiB
#3 Accepted 7ms 532.0 KiB
#4 Accepted 6ms 532.0 KiB
#5 Accepted 39ms 560.0 KiB
#6 Accepted 38ms 536.0 KiB

Code

/*
    1 2 3 4 5 6 7 8 9 10 11
    5 6

    4 6
    3 6
    3 5
    3 4
    2 4
    1 4
    1 3
    1 3
    0 3

    4 6
    4 5
    4 4
    3 4
    2 4
    2 3
    2 2
    1 2
    0 2

    2 2 3 2 2

    od = 1
    ev = 4

    1 4


*/

/* Solved by Sakhawat Hossain Mahin, CSE-28th, SMUCT */
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long

#define faf ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define test  \
    int T;    \
    cin >> T; \
    while (T--)

const int N = 1e5 + 7;
int ar[N];

void crack()
{
    //     int n;
    //     cin>>n;
    //     int od = 0, ev = 0;
    //     for(int i = 0; i < n; i++){
    //         int x;
    //         cin>>x;
    //         if(x&1){
    //             od++;
    //         }
    //         else ev++;
    //     }
    //     od = (od < ev ? ev : od);
    //     if(ev&1){
    //         if(od == ev){
    //             cout << "Hridoy";
    //         }
    //         else cout << "Roy";
    //     }
    //     else{
    //         if(od == ev+1){
    //             cout << "Roy";
    //         }
    //         else cout << "Hridoy";
    //     }
    //     cout << endl;

    int n;
    cin >> n;
    int x, od = 0, ev = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        if (x % 2 == 0)
        {
            ev++;
        }
        else
        {
            od++;
        }
    }
    if (od < ev)
        swap(od, ev);
    if (ev % 2 == 1)
    {
        if (od == ev)
            cout << "Hridoy" << endl;
        else
            cout << "Roy" << endl;
    }
    else
    {
        if (od == ev + 1)
            cout << "Roy" << endl;
        else
            cout << "Hridoy" << endl;
    }
}

int32_t main()
{
    faf auto st = clock();
    test
    crack();
    cerr << 1.0 * (clock() - st) / CLOCKS_PER_SEC << endl;
    return 0;
}

/*
    od = 5, ev = 5;
    roy hridoy
r    4-5
h    3-5
r    3-4
h    3-3
r    2-3
h    1-3
r    1-2
h    1-1
r    0-1
h
r wins
*/

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-04 13:09:57
Judged At
2024-10-04 13:09:57
Judged By
Score
100
Total Time
39ms
Peak Memory
568.0 KiB