結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
![]() |
提出日時 | 2020-10-23 23:08:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 82,112 KB |
実行使用メモリ | 84,360 KB |
最終ジャッジ日時 | 2024-07-21 12:27:53 |
合計ジャッジ時間 | 5,510 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 35 WA * 8 |
ソースコード
def f(s, total): if total > V: dp[s] = 0 return 0 if dp[s] != -1: return dp[s] R = 0 for i in range(N): if (1<<i) & s: continue c = f((1<<i)|s, total+X[i]) R = R|c dp[s] = R return not R N, V = map(int, input().split()) X = list(map(int, input().split())) dp = [-1]*(2**N) if sum(X) <= V: print("Draw") elif f(0, 0): print("Second") else: print("First")