結果

問題 No.1267 Stop and Coin Game
ユーザー stnkienstnkien
提出日時 2020-10-24 00:32:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 388 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 1,601 ms
コンパイル使用メモリ 86,520 KB
実行使用メモリ 85,068 KB
最終ジャッジ日時 2023-09-28 19:42:31
合計ジャッジ時間 8,468 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,332 KB
testcase_01 AC 75 ms
71,304 KB
testcase_02 AC 75 ms
71,280 KB
testcase_03 AC 75 ms
71,380 KB
testcase_04 AC 77 ms
71,348 KB
testcase_05 AC 89 ms
76,500 KB
testcase_06 AC 85 ms
75,868 KB
testcase_07 AC 75 ms
71,188 KB
testcase_08 AC 118 ms
77,316 KB
testcase_09 AC 82 ms
76,076 KB
testcase_10 AC 333 ms
85,068 KB
testcase_11 AC 153 ms
78,776 KB
testcase_12 AC 93 ms
76,524 KB
testcase_13 AC 76 ms
71,296 KB
testcase_14 AC 76 ms
71,088 KB
testcase_15 AC 83 ms
76,284 KB
testcase_16 AC 342 ms
84,756 KB
testcase_17 AC 77 ms
71,300 KB
testcase_18 AC 86 ms
76,512 KB
testcase_19 AC 76 ms
71,308 KB
testcase_20 AC 85 ms
76,064 KB
testcase_21 AC 74 ms
71,268 KB
testcase_22 AC 86 ms
76,256 KB
testcase_23 AC 75 ms
71,184 KB
testcase_24 AC 199 ms
81,164 KB
testcase_25 AC 220 ms
80,744 KB
testcase_26 AC 75 ms
71,228 KB
testcase_27 AC 95 ms
76,660 KB
testcase_28 AC 74 ms
71,200 KB
testcase_29 AC 89 ms
76,116 KB
testcase_30 AC 374 ms
85,064 KB
testcase_31 AC 86 ms
76,384 KB
testcase_32 AC 109 ms
77,324 KB
testcase_33 AC 204 ms
81,124 KB
testcase_34 AC 210 ms
80,672 KB
testcase_35 AC 388 ms
85,004 KB
testcase_36 AC 76 ms
71,304 KB
testcase_37 AC 118 ms
77,268 KB
testcase_38 AC 364 ms
85,008 KB
testcase_39 AC 103 ms
76,892 KB
testcase_40 AC 75 ms
71,308 KB
testcase_41 AC 106 ms
76,604 KB
testcase_42 AC 75 ms
71,088 KB
testcase_43 AC 113 ms
77,496 KB
testcase_44 AC 75 ms
70,980 KB
testcase_45 AC 76 ms
71,348 KB
testcase_46 AC 75 ms
71,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

dp = [0]*(1<<N)
for bit in range((1<<N)-1, -1, -1):
    tot = 0
    res = 0
    for i in range(N):
        if bit >> i & 1:
            tot += A[i]
        else:
            nb = bit|(1<<i)
            if dp[nb] == 0:
                res = 1
    if tot > V:
        dp[bit] = 1
    else:
        dp[bit] = res
print('First' if dp[0] == 1 else 'Second')
0