結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
|
提出日時 | 2020-10-24 00:58:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 448 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 82,988 KB |
実行使用メモリ | 84,804 KB |
最終ジャッジ日時 | 2024-07-21 14:35:49 |
合計ジャッジ時間 | 5,283 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 32 WA * 11 |
ソースコード
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] = 0return 0if dp[S] != -1:return dp[S]res = 0for i in range(n):if (1 << i) & S:continueres |= dfs((1 << i) | S, t + a[i])dp[S] = resreturn resif dfs(0, 0):print("Second")else:print("First")