結果

問題 No.1267 Stop and Coin Game
ユーザー AEnAEn
提出日時 2022-11-28 22:56:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 699 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 92,684 KB
最終ジャッジ日時 2024-04-15 20:17:31
合計ジャッジ時間 7,647 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,096 KB
testcase_01 AC 41 ms
51,712 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 39 ms
51,968 KB
testcase_05 AC 47 ms
59,904 KB
testcase_06 AC 47 ms
59,904 KB
testcase_07 AC 39 ms
51,712 KB
testcase_08 AC 98 ms
74,496 KB
testcase_09 AC 46 ms
59,392 KB
testcase_10 AC 518 ms
87,552 KB
testcase_11 AC 174 ms
80,256 KB
testcase_12 AC 81 ms
73,216 KB
testcase_13 AC 39 ms
52,096 KB
testcase_14 AC 40 ms
52,352 KB
testcase_15 AC 54 ms
62,592 KB
testcase_16 AC 658 ms
92,644 KB
testcase_17 AC 39 ms
52,224 KB
testcase_18 AC 66 ms
66,688 KB
testcase_19 AC 39 ms
51,712 KB
testcase_20 AC 48 ms
59,904 KB
testcase_21 AC 39 ms
51,712 KB
testcase_22 AC 65 ms
67,200 KB
testcase_23 AC 40 ms
52,096 KB
testcase_24 AC 192 ms
80,000 KB
testcase_25 AC 387 ms
86,656 KB
testcase_26 AC 39 ms
52,352 KB
testcase_27 AC 53 ms
61,824 KB
testcase_28 AC 40 ms
52,096 KB
testcase_29 AC 62 ms
65,392 KB
testcase_30 AC 423 ms
84,224 KB
testcase_31 AC 67 ms
67,456 KB
testcase_32 AC 74 ms
66,688 KB
testcase_33 AC 181 ms
79,800 KB
testcase_34 AC 336 ms
85,120 KB
testcase_35 AC 411 ms
84,132 KB
testcase_36 AC 38 ms
51,840 KB
testcase_37 AC 131 ms
77,696 KB
testcase_38 AC 699 ms
92,684 KB
testcase_39 AC 107 ms
77,056 KB
testcase_40 AC 38 ms
52,096 KB
testcase_41 AC 108 ms
77,184 KB
testcase_42 AC 39 ms
51,840 KB
testcase_43 AC 140 ms
77,888 KB
testcase_44 AC 40 ms
52,096 KB
testcase_45 AC 40 ms
51,968 KB
testcase_46 AC 40 ms
51,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, V = map(int,input().split())
A = list(map(int, input().split()))

if sum(A)<=V:
    print('Draw')
else:
    dp = [False]*(1<<N)
    for i in range(1<<N):
        sm = 0
        for j in range(N):
            if not i&(1<<j):
                sm += A[j]
        if sm>V:
            continue
        for j in range(N):
            if i&(1<<j) and V-sm>=A[j]:
                dp[i] |= dp[i^(1<<j)]^1
    print('First' if dp[-1] else 'Second')

0