結果

問題 No.1267 Stop and Coin Game
ユーザー 👑 rin204rin204
提出日時 2022-07-10 15:14:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 522 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 85,600 KB
最終ジャッジ日時 2023-09-01 21:32:44
合計ジャッジ時間 8,924 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,328 KB
testcase_01 AC 69 ms
71,212 KB
testcase_02 AC 69 ms
71,476 KB
testcase_03 AC 69 ms
71,428 KB
testcase_04 AC 74 ms
71,272 KB
testcase_05 AC 78 ms
76,348 KB
testcase_06 AC 75 ms
76,648 KB
testcase_07 AC 68 ms
71,052 KB
testcase_08 AC 108 ms
77,636 KB
testcase_09 AC 72 ms
76,360 KB
testcase_10 AC 492 ms
85,400 KB
testcase_11 AC 154 ms
79,460 KB
testcase_12 AC 93 ms
76,864 KB
testcase_13 AC 70 ms
71,480 KB
testcase_14 AC 69 ms
71,372 KB
testcase_15 AC 78 ms
76,784 KB
testcase_16 AC 522 ms
85,164 KB
testcase_17 AC 69 ms
71,352 KB
testcase_18 AC 87 ms
76,572 KB
testcase_19 AC 70 ms
71,416 KB
testcase_20 AC 78 ms
76,700 KB
testcase_21 AC 70 ms
71,040 KB
testcase_22 AC 88 ms
76,688 KB
testcase_23 AC 69 ms
71,388 KB
testcase_24 AC 198 ms
81,160 KB
testcase_25 AC 249 ms
81,492 KB
testcase_26 AC 71 ms
71,352 KB
testcase_27 AC 83 ms
76,632 KB
testcase_28 AC 70 ms
71,212 KB
testcase_29 AC 86 ms
76,456 KB
testcase_30 AC 465 ms
85,600 KB
testcase_31 AC 84 ms
76,732 KB
testcase_32 AC 99 ms
77,764 KB
testcase_33 AC 193 ms
81,244 KB
testcase_34 AC 230 ms
81,236 KB
testcase_35 AC 445 ms
85,208 KB
testcase_36 AC 68 ms
71,476 KB
testcase_37 AC 123 ms
78,272 KB
testcase_38 AC 509 ms
85,240 KB
testcase_39 AC 108 ms
77,236 KB
testcase_40 AC 66 ms
71,384 KB
testcase_41 AC 109 ms
77,072 KB
testcase_42 AC 67 ms
71,268 KB
testcase_43 AC 119 ms
78,008 KB
testcase_44 AC 67 ms
71,380 KB
testcase_45 AC 68 ms
71,272 KB
testcase_46 AC 68 ms
71,428 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