結果

問題 No.2551 2, 3, 5, 7 Game
コンテスト
ユーザー LyricalMaestro
提出日時 2026-07-17 23:40:40
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 813 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 263 ms
コンパイル使用メモリ 95,956 KB
実行使用メモリ 305,156 KB
最終ジャッジ日時 2026-07-17 23:40:47
合計ジャッジ時間 6,591 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

## https://yukicoder.me/problems/no/2551

def solve(N):


    def dfs(x, memo):
        if x in memo:
            return memo[x]

        can_win = False
        for a in [2, 3, 5, 7]:
            if x * a >= N:
                break
            else:
                c = dfs(x * a, memo)
                if c == 0:
                    can_win = True
        if can_win:
            memo[x] = 1
            return 1
        else:
            memo[x] = 0
            return 0

    c = dfs(1, {})
    if c == 1:
        return "sepa"
    else:
        return "ryota"



def main():
    T = int(input())
    answers = []
    for _ in range(T):
        N = int(input())
        ans = solve(N)
        answers.append(ans)

    for ans in answers:
        print(ans)















if __name__ == "__main__":
    main()
0