結果

問題 No.1267 Stop and Coin Game
コンテスト
ユーザー ああ
提出日時 2026-05-28 21:02:53
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 407 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 640 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 89,088 KB
最終ジャッジ日時 2026-05-28 21:03:00
合計ジャッジ時間 6,182 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,v=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)<=v:
    print("Draw");exit()
dp=[0]*(1<<n)
for i in range((1<<n)-2,-1,-1):
    c=0
    for j in range(n):
        c+=(i>>j&1)*a[j]
    if v<c:
        continue
    s=0
    for j in range(n):
        if i>>j&1 or c+a[j]>v:
            continue
        if not dp[i|1<<j]:
            s=1
    dp[i]=s
print("First" if dp[0] else "Second")
0