結果

問題 No.1267 Stop and Coin Game
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-10-24 00:59:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 460 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 20,856 KB
最終ジャッジ日時 2023-09-28 19:52:27
合計ジャッジ時間 14,418 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,220 KB
testcase_01 AC 16 ms
8,172 KB
testcase_02 AC 16 ms
7,796 KB
testcase_03 AC 17 ms
7,952 KB
testcase_04 AC 16 ms
7,832 KB
testcase_05 AC 16 ms
7,980 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,728 KB
testcase_08 AC 38 ms
8,964 KB
testcase_09 AC 17 ms
7,820 KB
testcase_10 AC 1,152 ms
16,276 KB
testcase_11 AC 504 ms
10,068 KB
testcase_12 AC 106 ms
8,380 KB
testcase_13 AC 16 ms
7,776 KB
testcase_14 AC 16 ms
7,732 KB
testcase_15 AC 17 ms
7,824 KB
testcase_16 TLE -
testcase_17 AC 17 ms
7,860 KB
testcase_18 AC 23 ms
7,764 KB
testcase_19 AC 17 ms
8,128 KB
testcase_20 AC 16 ms
7,808 KB
testcase_21 AC 16 ms
7,812 KB
testcase_22 AC 23 ms
7,952 KB
testcase_23 AC 17 ms
7,820 KB
testcase_24 AC 111 ms
12,252 KB
testcase_25 TLE -
testcase_26 AC 16 ms
8,120 KB
testcase_27 AC 17 ms
8,236 KB
testcase_28 AC 16 ms
8,248 KB
testcase_29 AC 18 ms
7,808 KB
testcase_30 AC 43 ms
16,376 KB
testcase_31 AC 32 ms
8,292 KB
testcase_32 AC 18 ms
9,180 KB
testcase_33 AC 27 ms
12,136 KB
testcase_34 AC 1,485 ms
12,104 KB
testcase_35 AC 35 ms
16,272 KB
testcase_36 AC 16 ms
8,124 KB
testcase_37 AC 406 ms
9,144 KB
testcase_38 TLE -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

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