結果

問題 No.1267 Stop and Coin Game
ユーザー nehan_der_thalnehan_der_thal
提出日時 2020-10-23 23:10:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 664 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 93,384 KB
最終ジャッジ日時 2023-09-28 17:51:06
合計ジャッジ時間 8,101 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,924 KB
testcase_01 AC 74 ms
71,372 KB
testcase_02 AC 74 ms
71,448 KB
testcase_03 AC 78 ms
71,320 KB
testcase_04 AC 76 ms
71,224 KB
testcase_05 AC 74 ms
71,260 KB
testcase_06 AC 79 ms
71,048 KB
testcase_07 AC 74 ms
70,976 KB
testcase_08 AC 106 ms
78,880 KB
testcase_09 AC 75 ms
70,980 KB
testcase_10 AC 304 ms
93,316 KB
testcase_11 AC 184 ms
81,072 KB
testcase_12 AC 111 ms
77,824 KB
testcase_13 AC 74 ms
71,392 KB
testcase_14 AC 73 ms
70,928 KB
testcase_15 AC 82 ms
75,624 KB
testcase_16 AC 533 ms
93,212 KB
testcase_17 AC 75 ms
71,088 KB
testcase_18 AC 98 ms
76,512 KB
testcase_19 AC 73 ms
70,924 KB
testcase_20 AC 74 ms
71,224 KB
testcase_21 AC 73 ms
71,444 KB
testcase_22 AC 93 ms
76,504 KB
testcase_23 AC 73 ms
71,240 KB
testcase_24 AC 120 ms
85,192 KB
testcase_25 AC 398 ms
84,868 KB
testcase_26 AC 74 ms
71,076 KB
testcase_27 AC 74 ms
71,744 KB
testcase_28 AC 75 ms
71,264 KB
testcase_29 AC 90 ms
76,368 KB
testcase_30 AC 112 ms
92,568 KB
testcase_31 AC 98 ms
77,648 KB
testcase_32 AC 76 ms
73,116 KB
testcase_33 AC 94 ms
84,588 KB
testcase_34 AC 310 ms
85,280 KB
testcase_35 AC 96 ms
87,632 KB
testcase_36 AC 78 ms
71,288 KB
testcase_37 AC 150 ms
78,992 KB
testcase_38 AC 664 ms
93,384 KB
testcase_39 AC 127 ms
78,168 KB
testcase_40 AC 75 ms
71,176 KB
testcase_41 AC 122 ms
78,604 KB
testcase_42 AC 73 ms
70,968 KB
testcase_43 AC 148 ms
78,936 KB
testcase_44 AC 77 ms
79,360 KB
testcase_45 AC 74 ms
71,056 KB
testcase_46 AC 73 ms
71,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(s, total):
    if total > V:
        dp[s] = 0
        return 0
    if dp[s] != -1:
        return dp[s]
    R = 0
    for i in range(N):
        if (1<<i) & s:
            continue
        c = f((1<<i)|s, total+X[i])
        R = R|c
    dp[s] = (not R)
    return not R


N, V = map(int, input().split())
X = list(map(int, input().split()))
dp = [-1]*(2**N)
if sum(X) <= V:
    print("Draw")
elif f(0, 0):
    print("Second")
else:
    print("First")
0