結果
| 問題 | No.1267 Stop and Coin Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-31 17:41:48 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 272 ms / 2,000 ms |
| コード長 | 470 bytes |
| 記録 | |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 85,288 KB |
| 実行使用メモリ | 89,268 KB |
| 最終ジャッジ日時 | 2026-04-03 07:33:06 |
| 合計ジャッジ時間 | 4,368 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge2_0 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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")