/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Wrong Answer 32ms 564.0 KiB
#3 Wrong Answer 11ms 380.0 KiB

Code

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

#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define yes cout << "YES" << endl 
#define no cout << "NO" << endl 
#define pb push_back
#define l_b lower_bound
#define u_b upper_bound
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef map<int, int> mii;
typedef unordered_map<int, int> umap_ii;
typedef unordered_map<string, int> umap_si;


/**
 * Limits in C++ for reference
 * _____________________________________________________________________________________
 * |Sr| Macro Name | Description                     | Value
 * |No|____________|_________________________________|__________________________________
 * |1.| ULLONG_MAX | Maximum value unsigned long long| 18,446,744,073,709,551,615 (10^20)
 * |2.| LLONG_MAX  | Maximum value long long         | 9,223,372,036,854,775,807 (10^19)
 * |3.| LLONG_MIN  | Minimum value long long         |-9,223,372,036,854,775,808 -1*(10^19)
 * |4.| INT_MAX    | Maximum value int               | 2,147,483,647 (10^10)
 * |5.| INT_MIN    | Minimum value int               |-2,147,483,648 (10^10)
*/

void solve()
{
    // Do your thing here :)
    ll n;
    cin >> n;
    vl a(n);
    for(int i=0; i<n; i++) cin >> a[i];

    ll odd = 0, even = 0;
    for(int i=0; i<n; i++) {
        if(a[i]%2==0) {
            even++;
        }
        else {
            odd++;
        }
    }

    string ans;
    if(n==1) {
        ans = "Roy";
    }
    else if(n==2) {
        ans = "Hridoy";
    }
    else if(n==3) {

        if(odd==3 || even==3) {
            ans = "Hridoy";
        }
        else {
            ans = "Roy";
        }
    }
    else if(n>=4) {

        ll royT = (n/2)+(n%2);
        if(royT%2==0) {
            ll tmp = royT/2;
            if(tmp<=even && tmp<=odd) {
                ans = "Roy";
            }
            else {
                ans = "Hridoy";
            }
        }
        else if(royT%2==1) {
            if(even>odd) {
                ll tmp1 = (royT/2)+1;
                ll tmp2 = (royT/2);
                if(tmp1<=even && odd>=tmp2) {
                    ans = "Roy";
                }
                else {
                    ans = "Hridoy";
                }
            }
            else if(even,odd) {
                ll tmp1 = (royT/2)+1;
                ll tmp2 = (royT/2);
                if(tmp1<=odd && even>=tmp2) {
                    ans = "Roy";
                }
                else {
                    ans = "Hridoy";
                }
            }
        }
    }

    cout << ans << endl;
}


int main()
{

    _fastio;
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}

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 16:10:29
Judged At
2024-12-17 11:35:19
Judged By
Score
1
Total Time
32ms
Peak Memory
564.0 KiB