結果
| 問題 |
No.1770 N言っちゃダメゲーム (6)
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:57:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,039 bytes |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 82,260 KB |
| 実行使用メモリ | 92,812 KB |
| 最終ジャッジ日時 | 2025-06-12 16:57:40 |
| 合計ジャッジ時間 | 5,316 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 RE * 28 |
ソースコード
import sys
from functools import lru_cache
def main():
N, K = map(int, sys.stdin.readline().split())
@lru_cache(maxsize=None)
def can_win(n, last):
for t in range(1, K+1):
if t == last:
continue
if n + t >= N:
continue
if not can_win(n + t, t):
return True
return False
result = []
for m in range(1, K+1):
if m >= N:
continue
T = []
for t in range(1, K+1):
if t == m:
continue
if m + t >= N:
continue
T.append(t)
if not T:
result.append(m)
continue
all_win = True
for t in T:
if not can_win(m + t, t):
all_win = False
break
if all_win:
result.append(m)
if not result:
print(0)
else:
for num in sorted(result):
print(num)
if __name__ == "__main__":
main()
gew1fw