結果

問題 No.1267 Stop and Coin Game
ユーザー H3PO4H3PO4
提出日時 2022-02-05 14:17:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,128 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 86,144 KB
最終ジャッジ日時 2023-09-02 06:37:05
合計ジャッジ時間 15,338 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,220 KB
testcase_01 AC 76 ms
71,080 KB
testcase_02 AC 74 ms
71,032 KB
testcase_03 AC 72 ms
71,384 KB
testcase_04 AC 76 ms
71,384 KB
testcase_05 AC 130 ms
78,120 KB
testcase_06 AC 98 ms
76,756 KB
testcase_07 AC 74 ms
70,984 KB
testcase_08 AC 222 ms
78,780 KB
testcase_09 AC 81 ms
75,956 KB
testcase_10 AC 1,111 ms
86,004 KB
testcase_11 AC 337 ms
80,696 KB
testcase_12 AC 159 ms
77,924 KB
testcase_13 AC 73 ms
71,196 KB
testcase_14 AC 74 ms
71,188 KB
testcase_15 AC 99 ms
76,512 KB
testcase_16 AC 1,120 ms
86,064 KB
testcase_17 AC 73 ms
71,288 KB
testcase_18 AC 123 ms
77,572 KB
testcase_19 AC 72 ms
71,240 KB
testcase_20 AC 96 ms
76,664 KB
testcase_21 AC 72 ms
70,984 KB
testcase_22 AC 131 ms
77,876 KB
testcase_23 AC 73 ms
71,180 KB
testcase_24 AC 539 ms
82,092 KB
testcase_25 AC 566 ms
82,012 KB
testcase_26 AC 71 ms
71,028 KB
testcase_27 AC 151 ms
78,584 KB
testcase_28 AC 73 ms
71,404 KB
testcase_29 AC 116 ms
77,272 KB
testcase_30 AC 1,091 ms
86,056 KB
testcase_31 AC 127 ms
77,868 KB
testcase_32 AC 214 ms
78,748 KB
testcase_33 AC 533 ms
81,956 KB
testcase_34 AC 556 ms
82,012 KB
testcase_35 AC 1,086 ms
86,144 KB
testcase_36 AC 72 ms
71,000 KB
testcase_37 AC 229 ms
78,796 KB
testcase_38 AC 1,128 ms
86,104 KB
testcase_39 AC 180 ms
78,176 KB
testcase_40 AC 73 ms
71,372 KB
testcase_41 AC 181 ms
78,184 KB
testcase_42 AC 72 ms
71,476 KB
testcase_43 AC 223 ms
78,524 KB
testcase_44 AC 72 ms
71,488 KB
testcase_45 AC 71 ms
71,188 KB
testcase_46 AC 73 ms
71,400 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
    for i in range(N):
        if (b >> i) & 1:
            if not dp[b - (1 << i)]:
                dp[b] = True
print("First" if dp[-1] else "Second")
0