結果

問題 No.1267 Stop and Coin Game
ユーザー 👑 KazunKazun
提出日時 2020-10-23 22:50:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 548 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 94,432 KB
最終ジャッジ日時 2023-09-28 17:17:45
合計ジャッジ時間 9,182 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,288 KB
testcase_01 AC 80 ms
71,044 KB
testcase_02 AC 78 ms
71,620 KB
testcase_03 AC 78 ms
71,088 KB
testcase_04 AC 77 ms
71,284 KB
testcase_05 AC 83 ms
76,744 KB
testcase_06 AC 83 ms
76,636 KB
testcase_07 AC 76 ms
71,424 KB
testcase_08 AC 127 ms
79,664 KB
testcase_09 AC 81 ms
76,496 KB
testcase_10 AC 527 ms
94,432 KB
testcase_11 AC 160 ms
81,444 KB
testcase_12 AC 121 ms
78,820 KB
testcase_13 AC 77 ms
71,316 KB
testcase_14 AC 75 ms
71,344 KB
testcase_15 AC 82 ms
76,344 KB
testcase_16 AC 548 ms
94,320 KB
testcase_17 AC 74 ms
71,636 KB
testcase_18 AC 95 ms
76,824 KB
testcase_19 AC 75 ms
71,628 KB
testcase_20 AC 83 ms
76,500 KB
testcase_21 AC 75 ms
71,384 KB
testcase_22 AC 88 ms
76,708 KB
testcase_23 AC 75 ms
71,512 KB
testcase_24 AC 209 ms
85,764 KB
testcase_25 AC 331 ms
86,352 KB
testcase_26 AC 78 ms
71,248 KB
testcase_27 AC 89 ms
77,208 KB
testcase_28 AC 75 ms
71,556 KB
testcase_29 AC 87 ms
76,668 KB
testcase_30 AC 413 ms
93,176 KB
testcase_31 AC 108 ms
76,732 KB
testcase_32 AC 108 ms
78,632 KB
testcase_33 AC 182 ms
85,064 KB
testcase_34 AC 318 ms
86,156 KB
testcase_35 AC 409 ms
93,376 KB
testcase_36 AC 73 ms
71,252 KB
testcase_37 AC 155 ms
80,236 KB
testcase_38 AC 462 ms
93,444 KB
testcase_39 AC 140 ms
78,832 KB
testcase_40 AC 76 ms
71,416 KB
testcase_41 AC 132 ms
78,804 KB
testcase_42 AC 72 ms
71,412 KB
testcase_43 AC 120 ms
79,444 KB
testcase_44 AC 75 ms
71,412 KB
testcase_45 AC 74 ms
71,572 KB
testcase_46 AC 75 ms
71,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x):
    if T[x]!=None:
        return T[x]

    for j in range(N):
        if x&(1<<j)==0 and S[x|(1<<j)]<=V:
            if not f(x|(1<<j)):
                T[x]=True
                return True

    T[x]=False
    return False

N,V=map(int,input().split())
A=list(map(int,input().split()))

if sum(A)<=V:
    print("Draw")
    exit()

S=[0]*(1<<N)
for b in range(1<<N):
    a=b
    x=0
    for k in range(N):
        if b&1:
            x+=A[k]
        b>>=1
    S[a]=x

T=[None]*(1<<N)

if f(0):
    print("First")
else:
    print("Second")
0