結果
問題 |
No.1770 N言っちゃダメゲーム (6)
|
ユーザー |
![]() |
提出日時 | 2025-03-20 20:57:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 999 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,572 KB |
実行使用メモリ | 110,080 KB |
最終ジャッジ日時 | 2025-03-20 20:57:21 |
合計ジャッジ時間 | 5,882 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 3 TLE * 1 -- * 23 |
ソースコード
N, K = map(int, input().split()) win = [False] * (N + K + 2) last = [[False] * (K + 2) for _ in range(N + K + 2)] for S in range(N-1, -1, -1): for L in range(K+1): can_win = False for m in range(1, K+1): if m == L: continue if S + m >= N: continue if not last[S + m][m]: can_win = True break win_state = can_win last[S][L] = win_state result = [] for x in range(1, K+1): S = x L = x if S >= N: continue opponent_can_win = False for y in range(1, K+1): if y == x: continue new_S = S + y new_L = y if new_S >= N: opponent_can_win = True break if not last[new_S][new_L]: opponent_can_win = True break if not opponent_can_win: result.append(x) if result: for num in sorted(result): print(num) else: print(0)