結果

問題 No.1267 Stop and Coin Game
ユーザー H3PO4H3PO4
提出日時 2022-02-05 14:19:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,172 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 87,328 KB
最終ジャッジ日時 2023-09-02 06:37:29
合計ジャッジ時間 14,911 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,244 KB
testcase_01 AC 74 ms
71,152 KB
testcase_02 AC 76 ms
71,452 KB
testcase_03 AC 74 ms
71,308 KB
testcase_04 AC 75 ms
71,344 KB
testcase_05 AC 167 ms
78,452 KB
testcase_06 AC 86 ms
76,108 KB
testcase_07 AC 72 ms
71,400 KB
testcase_08 AC 274 ms
80,040 KB
testcase_09 AC 79 ms
75,532 KB
testcase_10 AC 987 ms
87,072 KB
testcase_11 AC 360 ms
80,988 KB
testcase_12 AC 189 ms
79,224 KB
testcase_13 AC 73 ms
71,508 KB
testcase_14 AC 74 ms
71,524 KB
testcase_15 AC 92 ms
76,292 KB
testcase_16 AC 998 ms
87,180 KB
testcase_17 AC 76 ms
71,320 KB
testcase_18 AC 132 ms
77,836 KB
testcase_19 AC 76 ms
71,480 KB
testcase_20 AC 88 ms
76,172 KB
testcase_21 AC 75 ms
71,156 KB
testcase_22 AC 127 ms
77,996 KB
testcase_23 AC 74 ms
71,276 KB
testcase_24 AC 511 ms
82,524 KB
testcase_25 AC 631 ms
83,484 KB
testcase_26 AC 76 ms
71,308 KB
testcase_27 AC 179 ms
79,292 KB
testcase_28 AC 74 ms
71,388 KB
testcase_29 AC 116 ms
77,680 KB
testcase_30 AC 875 ms
87,328 KB
testcase_31 AC 147 ms
78,516 KB
testcase_32 AC 229 ms
79,060 KB
testcase_33 AC 519 ms
82,696 KB
testcase_34 AC 641 ms
83,384 KB
testcase_35 AC 841 ms
87,276 KB
testcase_36 AC 76 ms
71,296 KB
testcase_37 AC 279 ms
79,812 KB
testcase_38 AC 1,172 ms
86,716 KB
testcase_39 AC 184 ms
78,588 KB
testcase_40 AC 72 ms
71,328 KB
testcase_41 AC 219 ms
79,736 KB
testcase_42 AC 73 ms
71,596 KB
testcase_43 AC 247 ms
79,116 KB
testcase_44 AC 73 ms
71,300 KB
testcase_45 AC 76 ms
71,276 KB
testcase_46 AC 75 ms
71,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if V >= sum(A):
    print("Draw")
    exit()

dp = [False] * (1 << N)
for b in range(1 << N):
    s = sum(a for i, a in enumerate(A) if not (b >> i) & 1)
    if V < s:
        dp[b] = True
        continue
    for i in range(N):
        if (b >> i) & 1:
            if not dp[b - (1 << i)]:
                dp[b] = True
                break
print("First" if dp[-1] else "Second")
0