結果
問題 |
No.1267 Stop and Coin Game
|
ユーザー |
![]() |
提出日時 | 2023-02-07 22:52:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 475 ms / 2,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 130 ms |
コンパイル使用メモリ | 82,028 KB |
実行使用メモリ | 83,972 KB |
最終ジャッジ日時 | 2024-07-05 16:48:33 |
合計ジャッジ時間 | 5,622 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
N, V = map(int, input().split()) A = list(map(int, input().split())) if sum(A) <= V: print("Draw") exit() N2 = 1 << N dp = [1] * N2 for s in range(N2 - 1, -1, -1): vol = V for i in range(N): if (s >> i) & 1: vol -= A[i] if vol < 0: continue for i in range(N): if (s >> i) & 1 == 0 and vol - A[i] >= 0: dp[s] &= dp[s | (1 << i)] dp[s] = 1 - dp[s] ans = 0 print("First") if dp[0] else print("Second")