結果
| 問題 | No.2551 2, 3, 5, 7 Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-17 23:39:37 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 816 bytes |
| 記録 | |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 95,968 KB |
| 実行使用メモリ | 304,448 KB |
| 最終ジャッジ日時 | 2026-07-17 23:39:45 |
| 合計ジャッジ時間 | 7,697 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 1 -- * 4 |
ソースコード
## 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:
continue
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()