結果
問題 |
No.3041 非対称じゃんけん
|
ユーザー |
![]() |
提出日時 | 2025-04-16 16:49:46 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,000 KB |
実行使用メモリ | 66,772 KB |
最終ジャッジ日時 | 2025-04-16 16:51:22 |
合計ジャッジ時間 | 2,657 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | RE * 30 |
ソースコード
n = int(input()) # Initialize DP table # dp[i][s] represents if the current player can win with i petals left and state s # s=0 (kirai), s=1 (suki) dp = [[False] * 2 for _ in range(n + 1)] # Base case: 0 petals left dp[0][1] = True # suki state means win dp[0][0] = False # kirai state means lose for i in range(1, n + 1): for s in [0, 1]: can_win = False for x in range(1, 4): if i >= x: next_n = i - x next_s = 1 - s # Toggle the state if next_n == 0: if next_s == 1: can_win = True break else: if not dp[next_n][next_s]: can_win = True break dp[i][s] = can_win print("Yes" if dp[n][0] else "No")