結果
問題 |
No.8 N言っちゃダメゲーム
|
ユーザー |
|
提出日時 | 2017-04-17 22:02:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 662 bytes |
コンパイル時間 | 73 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 43,008 KB |
最終ジャッジ日時 | 2024-07-19 05:39:38 |
合計ジャッジ時間 | 6,570 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 7 |
ソースコード
import sys sys.setrecursionlimit(10**7) def solve(): def memo_rec(m): if m == 0: return True if dp[m] is not None: return dp[m] for i in range(1, k + 1): if m - i < 0: break if not memo_rec(m - i): dp[m] = True return True dp[m] = False return False P = int(input()) for game in range(P): n, k = map(int, input().split()) dp = [None] * (n + 1) dp[0] = True ans = memo_rec(n) ans = 'Win' if ans else 'Lose' print(ans) if __name__ == '__main__': solve()