結果
問題 |
No.1267 Stop and Coin Game
|
ユーザー |
|
提出日時 | 2020-10-31 17:41:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 396 ms / 2,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 82,224 KB |
実行使用メモリ | 84,224 KB |
最終ジャッジ日時 | 2024-07-22 05:05:52 |
合計ジャッジ時間 | 6,185 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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() dp = [1]*(1<<n) for i in range(2**n-1,-1,-1): s = 0 for j in range(n): if i >> j & 1: s += a[j] if s > v: continue check = 0 for j in range(n): if i >> j & 1: continue if dp[i|1<<j] == 0: check = 1 dp[i] = check if dp[0]: print("First") else: print("Second")