結果

問題 No.3300 Frog Game
ユーザー 👑 SPD_9X2
提出日時 2025-10-05 15:47:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 2,024 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,796 KB
実行使用メモリ 56,044 KB
最終ジャッジ日時 2025-10-05 15:48:15
合計ジャッジ時間 2,834 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

100 2 3
[0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1]

[1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 1]


mod A+B で、A以下になると死ぬ

最初からA以下 -> 先手負け
其れ以外 -> Bを選ぶと後手が死ぬ

"""

def flat(lis):
    return [min(i,1) for i in lis]


def solve(N,A,B):

    N -= 1

    dp = [None] * (N+1)

    for i in range(N,-1,-1):

        s = []
        if i+A < len(dp):
            s.append(dp[i+A])
        else:
            s.append(2)
            
        if i+B < len(dp):
            s.append(dp[i+B])
        else:
            s.append(2)

        if 0 not in s:
            dp[i] = 0
        elif 1 not in s:
            dp[i] = 1
        else:
            dp[i] = 2

    return flat(dp)

def solve2(N,A,B):
    
    M = N % (A+B)
    if True:
        if M == 0 or M > B:
            x = 1
        else:
            x = ((M-1)//A%2)

            if B-M < A and x == 1:
                x = 2

    return min(1,x)


import random

"""
for i in range(100000):

    N = random.randint(10,50)
    A = random.randint(1,10)
    B = random.randint(A+1,100)

    ans1 = solve(N,A,B)
    ans2 = ( [solve2(i,A,B) for i in range(N,0,-1)] )

    if ans1 != ans2:
        print (N,A,B)
        print (ans1)
        print (ans2)
        assert ans1 == ans2

"""

N,A,B = map(int,input().split())

#ans1 = solve(N,A,B)
#ans2 = ( [solve2(i,A,B) for i in range(N,0,-1)] )

#print (ans1)
#print (ans2)

x = solve2(N-1,A,B)

if x == 0:
    print ("ryota")
else:
    print ("sepa")
0