結果

問題 No.1267 Stop and Coin Game
ユーザー nagissnagiss
提出日時 2020-10-23 22:50:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 579 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 16,404 KB
最終ジャッジ日時 2023-09-28 17:15:07
合計ジャッジ時間 21,716 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,828 KB
testcase_01 AC 17 ms
8,228 KB
testcase_02 AC 17 ms
7,828 KB
testcase_03 AC 17 ms
7,940 KB
testcase_04 AC 17 ms
7,772 KB
testcase_05 AC 27 ms
8,112 KB
testcase_06 AC 17 ms
7,876 KB
testcase_07 AC 17 ms
7,836 KB
testcase_08 AC 237 ms
9,172 KB
testcase_09 AC 17 ms
7,880 KB
testcase_10 TLE -
testcase_11 AC 547 ms
10,060 KB
testcase_12 AC 84 ms
8,212 KB
testcase_13 AC 17 ms
7,960 KB
testcase_14 AC 17 ms
7,932 KB
testcase_15 AC 18 ms
7,804 KB
testcase_16 TLE -
testcase_17 AC 17 ms
7,940 KB
testcase_18 AC 23 ms
7,960 KB
testcase_19 AC 17 ms
8,280 KB
testcase_20 AC 17 ms
7,796 KB
testcase_21 AC 16 ms
7,848 KB
testcase_22 AC 23 ms
7,872 KB
testcase_23 AC 17 ms
7,828 KB
testcase_24 AC 1,120 ms
12,136 KB
testcase_25 AC 1,441 ms
12,192 KB
testcase_26 AC 17 ms
8,080 KB
testcase_27 AC 71 ms
8,220 KB
testcase_28 AC 17 ms
8,208 KB
testcase_29 AC 20 ms
7,792 KB
testcase_30 TLE -
testcase_31 AC 31 ms
8,252 KB
testcase_32 AC 260 ms
9,040 KB
testcase_33 AC 1,112 ms
12,120 KB
testcase_34 AC 1,300 ms
12,136 KB
testcase_35 TLE -
testcase_36 AC 17 ms
8,256 KB
testcase_37 AC 322 ms
9,024 KB
testcase_38 TLE -
testcase_39 AC 162 ms
8,604 KB
testcase_40 AC 16 ms
8,288 KB
testcase_41 AC 176 ms
8,488 KB
testcase_42 AC 17 ms
8,120 KB
testcase_43 AC 407 ms
9,008 KB
testcase_44 AC 22 ms
16,224 KB
testcase_45 AC 17 ms
8,168 KB
testcase_46 AC 16 ms
7,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, V = map(int, input().split())
    A = list(map(int, input().split()))
    Win = [False] * (1<<N)
    if sum(A) <= V:
        print("Draw")
        exit()
    for s in range((1<<N)-1, -1, -1):
        v = 0
        for idx_A, a in enumerate(A):
            if s>>idx_A&1:
                v += a
        if v > V:
            Win[s] = win = True
        else:
            win = Win[s]
        if not win:
            for idx_A in range(N):
                if s>>idx_A&1:
                    Win[s^1<<idx_A] = True
    print("First" if win else "Second")

main()
0