結果

問題 No.1267 Stop and Coin Game
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-10-24 00:59:48
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 636 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 93,360 KB
最終ジャッジ日時 2023-09-28 19:52:35
合計ジャッジ時間 8,203 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,452 KB
testcase_01 AC 76 ms
71,344 KB
testcase_02 AC 74 ms
71,336 KB
testcase_03 AC 74 ms
71,384 KB
testcase_04 AC 77 ms
71,320 KB
testcase_05 AC 75 ms
71,380 KB
testcase_06 AC 75 ms
71,384 KB
testcase_07 AC 73 ms
71,344 KB
testcase_08 AC 103 ms
78,780 KB
testcase_09 AC 74 ms
71,360 KB
testcase_10 AC 309 ms
93,292 KB
testcase_11 AC 178 ms
81,252 KB
testcase_12 AC 113 ms
77,972 KB
testcase_13 AC 74 ms
71,428 KB
testcase_14 AC 73 ms
71,220 KB
testcase_15 AC 83 ms
76,148 KB
testcase_16 AC 533 ms
93,360 KB
testcase_17 AC 76 ms
71,304 KB
testcase_18 AC 97 ms
76,628 KB
testcase_19 AC 75 ms
71,212 KB
testcase_20 AC 74 ms
71,520 KB
testcase_21 AC 75 ms
71,316 KB
testcase_22 AC 97 ms
76,260 KB
testcase_23 AC 76 ms
71,212 KB
testcase_24 AC 124 ms
85,536 KB
testcase_25 AC 436 ms
84,892 KB
testcase_26 AC 77 ms
71,168 KB
testcase_27 AC 73 ms
71,724 KB
testcase_28 AC 77 ms
71,464 KB
testcase_29 AC 91 ms
76,332 KB
testcase_30 AC 118 ms
93,056 KB
testcase_31 AC 102 ms
77,328 KB
testcase_32 AC 78 ms
73,572 KB
testcase_33 AC 96 ms
84,400 KB
testcase_34 AC 324 ms
85,268 KB
testcase_35 AC 94 ms
87,920 KB
testcase_36 AC 76 ms
71,212 KB
testcase_37 AC 148 ms
79,072 KB
testcase_38 AC 636 ms
93,324 KB
testcase_39 AC 126 ms
78,380 KB
testcase_40 AC 75 ms
71,020 KB
testcase_41 AC 125 ms
78,228 KB
testcase_42 AC 76 ms
71,404 KB
testcase_43 AC 151 ms
79,120 KB
testcase_44 AC 75 ms
71,528 KB
testcase_45 AC 75 ms
71,432 KB
testcase_46 AC 75 ms
71,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, v = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) <= v:
    exit(print("Draw"))
dp = [-1] * (1 << n)
def dfs(S, t):
    if t > v:
        dp[S] = 0
        return 0
    if dp[S] != -1:
        return dp[S]
    res = 0
    for i in range(n):
        if (1 << i) & S:
            continue
        res |= dfs((1 << i) | S, t + a[i])
    dp[S] = (not res)
    return (not res)
if dfs(0, 0):
    print("Second")
else:
    print("First")
0