/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.066 MiB
#2 Accepted 90ms 3.199 MiB
#3 Accepted 33ms 3.219 MiB
#4 Accepted 27ms 3.961 MiB
#5 Accepted 73ms 13.242 MiB
#6 Accepted 73ms 13.168 MiB

Code

import sys

input = lambda: sys.stdin.readline().rstrip("\r\n")
rint = lambda: int(input())
rlist = lambda: list(map(int, input().split()))


def solve():
    n = rint()
    a = rlist()
    odds = sum(x & 1 for x in a)
    evens = n - odds
    q = min(evens // 2, odds // 2)
    evens -= 2 * q
    odds -= 2 * q

    for first in range(2):
        results = []
        for second in range(2):
            path = [first, second, first ^ 1, second ^ 1]
            count = [evens, odds]
            for i, x in enumerate(path):
                count[x] -= 1
                if count[x] < 0:
                    winner = ~i & 1
                    break
            results.append(winner)
        if not any(results):
            return 1
    return 0


for tc in range(rint()):
    print("Roy" if solve() else "Hridoy")

Information

Submit By
Type
Submission
Problem
P1102 Odd-Even Game
Contest
Brain Booster #6
Language
Python 3 (Python 3.12.3)
Submit At
2024-10-03 15:38:16
Judged At
2024-12-17 11:36:30
Judged By
Score
100
Total Time
90ms
Peak Memory
13.242 MiB