/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 19ms 580.0 KiB
#3 Accepted 9ms 564.0 KiB
#4 Accepted 9ms 568.0 KiB
#5 Accepted 29ms 560.0 KiB
#6 Accepted 29ms 568.0 KiB

Code

/* 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&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;
}

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-04 13:10:31
Judged At
2024-11-11 02:42:53
Judged By
Score
100
Total Time
29ms
Peak Memory
580.0 KiB