結果

問題 No.1267 Stop and Coin Game
ユーザー rlangevinrlangevin
提出日時 2023-02-07 22:43:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 85,416 KB
最終ジャッジ日時 2023-09-19 04:06:27
合計ジャッジ時間 9,385 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,132 KB
testcase_01 AC 73 ms
71,116 KB
testcase_02 AC 73 ms
71,044 KB
testcase_03 AC 72 ms
71,292 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 80 ms
76,224 KB
testcase_07 WA -
testcase_08 AC 111 ms
77,492 KB
testcase_09 AC 79 ms
76,388 KB
testcase_10 WA -
testcase_11 AC 168 ms
78,748 KB
testcase_12 AC 99 ms
76,528 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 563 ms
84,748 KB
testcase_17 AC 73 ms
71,064 KB
testcase_18 AC 92 ms
76,312 KB
testcase_19 AC 72 ms
71,344 KB
testcase_20 AC 79 ms
76,376 KB
testcase_21 AC 72 ms
70,840 KB
testcase_22 AC 89 ms
76,272 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 320 ms
81,016 KB
testcase_26 AC 74 ms
71,256 KB
testcase_27 AC 84 ms
76,712 KB
testcase_28 AC 71 ms
71,396 KB
testcase_29 WA -
testcase_30 AC 428 ms
85,416 KB
testcase_31 AC 89 ms
76,096 KB
testcase_32 AC 102 ms
77,268 KB
testcase_33 AC 193 ms
81,072 KB
testcase_34 WA -
testcase_35 AC 421 ms
84,544 KB
testcase_36 AC 70 ms
71,192 KB
testcase_37 AC 132 ms
77,784 KB
testcase_38 AC 588 ms
84,916 KB
testcase_39 AC 117 ms
76,964 KB
testcase_40 AC 73 ms
70,836 KB
testcase_41 AC 113 ms
76,812 KB
testcase_42 AC 72 ms
71,300 KB
testcase_43 AC 135 ms
77,992 KB
testcase_44 AC 74 ms
71,132 KB
testcase_45 AC 72 ms
71,036 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, V = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) <= V:
    print("Draw")
    exit()
    
N2 = 1 << N
dp = [0] * N2
for s in range(N2 - 1, -1, -1):
    vol = V
    for i in range(N):
        if (s >> i) & 1:
            vol -= A[i]
    if vol < 0:
        continue
    for i in range(N):
        if (s >> i) & 1 == 0 and vol - A[i] >= 0:
            dp[s] ^= 1 - dp[s | (1 << i)]

ans = 0
for i in range(N):
    ans |= dp[1 << i]
print("First") if ans else print("Second")
0