結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
![]() |
提出日時 | 2020-10-23 22:59:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,035 ms / 2,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 82,032 KB |
実行使用メモリ | 85,736 KB |
最終ジャッジ日時 | 2024-07-21 12:08:35 |
合計ジャッジ時間 | 11,204 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
import sysinput = sys.stdin.readlineN, V = map(int, input().split())A = list(map(int, input().split()))if sum(A) <= V:print('Draw')exit()dp = [False] * (1 << N)for S in range(1 << N)[::-1]:s = sum(A[i] for i in range(N) if S >> i & 1)if s > V:dp[S] = Trueelse:dp[S] = any(not dp[S | 1 << i] for i in range(N) if not (S >> i & 1))print('First' if dp[0] else 'Second')