/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 12ms 2.715 MiB
#2 Accepted 12ms 2.891 MiB
#3 Accepted 12ms 2.887 MiB

Code

def counts_char(S):
    return {char: S.count(char) for char in {'p', 'q'}}
def winner(counts):
    p,q=counts["p"],counts["q"]
    if p>q:
        return "Roy"
    if p<q:
        return "Mahfuj"
    return "Draw"

def main():
    t = int(input().strip())
    for i in range(t):
        S = input().strip()
        counts=counts_char(S)
        result = winner(counts)
        print(result)

if __name__ == "__main__":
    main()

Information

Submit By
Type
Submission
Problem
P1040 Character game
Contest
TLE_Headquarters - round #1
Language
Python 3 (Python 3.12.3)
Submit At
2024-03-27 18:21:26
Judged At
2024-03-27 18:21:26
Judged By
Score
100
Total Time
12ms
Peak Memory
2.891 MiB