結果

問題 No.1267 Stop and Coin Game
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-10-31 17:41:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 447 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 85,248 KB
最終ジャッジ日時 2023-09-29 10:31:05
合計ジャッジ時間 9,023 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,204 KB
testcase_01 AC 75 ms
71,344 KB
testcase_02 AC 72 ms
71,348 KB
testcase_03 AC 72 ms
71,200 KB
testcase_04 AC 72 ms
71,364 KB
testcase_05 AC 92 ms
76,528 KB
testcase_06 AC 82 ms
76,076 KB
testcase_07 AC 71 ms
71,464 KB
testcase_08 AC 115 ms
77,500 KB
testcase_09 AC 80 ms
76,172 KB
testcase_10 AC 360 ms
85,036 KB
testcase_11 AC 166 ms
79,020 KB
testcase_12 AC 97 ms
76,612 KB
testcase_13 AC 72 ms
71,356 KB
testcase_14 AC 73 ms
71,232 KB
testcase_15 AC 86 ms
76,468 KB
testcase_16 AC 419 ms
85,004 KB
testcase_17 AC 75 ms
71,272 KB
testcase_18 AC 87 ms
76,404 KB
testcase_19 AC 74 ms
71,464 KB
testcase_20 AC 80 ms
76,152 KB
testcase_21 AC 74 ms
71,180 KB
testcase_22 AC 91 ms
76,396 KB
testcase_23 AC 75 ms
71,080 KB
testcase_24 AC 196 ms
80,996 KB
testcase_25 AC 300 ms
80,916 KB
testcase_26 AC 75 ms
71,008 KB
testcase_27 AC 93 ms
76,676 KB
testcase_28 AC 72 ms
71,436 KB
testcase_29 AC 91 ms
76,624 KB
testcase_30 AC 340 ms
85,136 KB
testcase_31 AC 89 ms
76,340 KB
testcase_32 AC 102 ms
77,340 KB
testcase_33 AC 197 ms
81,100 KB
testcase_34 AC 268 ms
81,072 KB
testcase_35 AC 329 ms
84,996 KB
testcase_36 AC 73 ms
71,404 KB
testcase_37 AC 131 ms
77,796 KB
testcase_38 AC 447 ms
85,248 KB
testcase_39 AC 112 ms
76,924 KB
testcase_40 AC 73 ms
71,252 KB
testcase_41 AC 116 ms
76,832 KB
testcase_42 AC 73 ms
71,212 KB
testcase_43 AC 133 ms
77,784 KB
testcase_44 AC 73 ms
71,212 KB
testcase_45 AC 73 ms
71,188 KB
testcase_46 AC 74 ms
71,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0