結果
問題 |
No.1267 Stop and Coin Game
|
ユーザー |
|
提出日時 | 2020-10-24 00:59:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 460 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 25,976 KB |
最終ジャッジ日時 | 2024-07-21 14:36:39 |
合計ジャッジ時間 | 14,572 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 TLE * 3 -- * 8 |
ソースコード
n, v = map(int, input().split()) a = list(map(int, input().split())) if sum(a) <= v: exit(print("Draw")) dp = [-1] * (1 << n) def dfs(S, t): if t > v: dp[S] = 0 return 0 if dp[S] != -1: return dp[S] res = 0 for i in range(n): if (1 << i) & S: continue res |= dfs((1 << i) | S, t + a[i]) dp[S] = (not res) return (not res) if dfs(0, 0): print("Second") else: print("First")