結果

問題 No.1267 Stop and Coin Game
ユーザー 👑 rin204rin204
提出日時 2022-07-10 15:02:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 610 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 85,460 KB
最終ジャッジ日時 2023-09-01 03:41:07
合計ジャッジ時間 10,669 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,564 KB
testcase_01 AC 69 ms
71,312 KB
testcase_02 AC 68 ms
71,604 KB
testcase_03 WA -
testcase_04 AC 69 ms
71,452 KB
testcase_05 AC 92 ms
76,508 KB
testcase_06 AC 77 ms
76,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 584 ms
85,280 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 69 ms
71,196 KB
testcase_14 AC 69 ms
71,456 KB
testcase_15 AC 77 ms
76,488 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 66 ms
71,492 KB
testcase_20 WA -
testcase_21 AC 67 ms
71,140 KB
testcase_22 WA -
testcase_23 AC 68 ms
71,304 KB
testcase_24 AC 248 ms
81,252 KB
testcase_25 WA -
testcase_26 AC 69 ms
71,096 KB
testcase_27 AC 93 ms
76,780 KB
testcase_28 AC 69 ms
71,572 KB
testcase_29 AC 85 ms
76,320 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 254 ms
81,144 KB
testcase_34 AC 248 ms
81,124 KB
testcase_35 WA -
testcase_36 AC 69 ms
71,424 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 68 ms
71,392 KB
testcase_41 WA -
testcase_42 AC 69 ms
71,404 KB
testcase_43 WA -
testcase_44 AC 68 ms
71,384 KB
testcase_45 WA -
testcase_46 AC 69 ms
71,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, v = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) < v:
    print("Draw")
    exit()
win = [True] * (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[i] = False
for bit in range((1 << n) - 1, -1, -1):
    if not 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