結果

問題 No.1267 Stop and Coin Game
ユーザー 👑 rin204rin204
提出日時 2022-07-10 15:13:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,592 KB
実行使用メモリ 85,276 KB
最終ジャッジ日時 2023-09-01 21:31:51
合計ジャッジ時間 8,819 ms
ジャッジサーバーID
(参考情報)
judge11 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,132 KB
testcase_01 AC 70 ms
71,224 KB
testcase_02 AC 70 ms
71,120 KB
testcase_03 AC 68 ms
71,108 KB
testcase_04 AC 68 ms
71,328 KB
testcase_05 AC 79 ms
76,384 KB
testcase_06 AC 76 ms
76,152 KB
testcase_07 AC 69 ms
71,124 KB
testcase_08 AC 111 ms
77,404 KB
testcase_09 AC 75 ms
76,344 KB
testcase_10 AC 485 ms
85,112 KB
testcase_11 AC 152 ms
78,824 KB
testcase_12 AC 94 ms
76,640 KB
testcase_13 AC 71 ms
71,232 KB
testcase_14 AC 70 ms
71,164 KB
testcase_15 AC 80 ms
76,400 KB
testcase_16 AC 520 ms
85,140 KB
testcase_17 AC 72 ms
71,240 KB
testcase_18 AC 86 ms
76,224 KB
testcase_19 AC 70 ms
71,232 KB
testcase_20 AC 77 ms
76,216 KB
testcase_21 AC 73 ms
71,208 KB
testcase_22 AC 90 ms
76,572 KB
testcase_23 AC 69 ms
71,296 KB
testcase_24 AC 196 ms
80,900 KB
testcase_25 AC 252 ms
80,928 KB
testcase_26 AC 71 ms
71,276 KB
testcase_27 AC 84 ms
76,796 KB
testcase_28 AC 71 ms
71,136 KB
testcase_29 AC 86 ms
76,364 KB
testcase_30 AC 449 ms
85,000 KB
testcase_31 AC 89 ms
76,232 KB
testcase_32 AC 103 ms
77,220 KB
testcase_33 AC 193 ms
80,852 KB
testcase_34 AC 236 ms
81,096 KB
testcase_35 AC 433 ms
84,948 KB
testcase_36 AC 69 ms
71,164 KB
testcase_37 AC 124 ms
77,884 KB
testcase_38 AC 507 ms
85,276 KB
testcase_39 AC 114 ms
76,940 KB
testcase_40 AC 71 ms
71,184 KB
testcase_41 AC 111 ms
77,108 KB
testcase_42 AC 70 ms
70,892 KB
testcase_43 AC 122 ms
77,556 KB
testcase_44 AC 69 ms
70,900 KB
testcase_45 WA -
testcase_46 AC 70 ms
71,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, v = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) < v:
    print("Draw")
    exit()
win = [False] * (1 << n)
for bit in range(1 << n):
    tot = 0
    for i in range(n):
        if bit >> i & 1:
            tot += A[i]
    if tot > v:
        win[bit] = True
for bit in range((1 << n) - 1, -1, -1):
    if win[bit]:
        continue
    win[bit] = False
    for i in range(n):
        if not bit >> i & 1:
            nbit = bit | (1 << i)
            if not win[nbit]:
                win[bit] = True
                break

if win[0]:
    print("First")
else:
    print("Second")
0