結果
問題 | No.1267 Stop and Coin Game |
ユーザー |
![]() |
提出日時 | 2020-10-23 22:22:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 476 ms / 2,000 ms |
コード長 | 417 bytes |
コンパイル時間 | 236 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 84,352 KB |
最終ジャッジ日時 | 2024-07-21 11:01:30 |
合計ジャッジ時間 | 6,682 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
n,v=map(int,input().split())a=list(map(int,input().split()))if sum(a)<=v:exit(print("Draw"))dp=[True]*(1<<n)for i in range((1<<n)-1,-1,-1):s=0for j in range(n):if i&(1<<j):s+=a[j]if s>v:dp[i]=(True)else:flag=Falsefor j in range(n):if i&(1<<j)==0:if dp[i|(1<<j)]==False:flag=Truedp[i]=flagif dp[0]:print("First")else:print("Second")