結果

問題 No.1267 Stop and Coin Game
ユーザー stnkienstnkien
提出日時 2020-10-23 23:30:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 84,568 KB
最終ジャッジ日時 2024-07-21 13:27:38
合計ジャッジ時間 7,010 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 AC 38 ms
51,584 KB
testcase_02 AC 40 ms
52,480 KB
testcase_03 AC 39 ms
52,608 KB
testcase_04 AC 41 ms
51,968 KB
testcase_05 AC 57 ms
66,048 KB
testcase_06 AC 45 ms
59,392 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 40 ms
52,352 KB
testcase_10 WA -
testcase_11 AC 150 ms
78,208 KB
testcase_12 WA -
testcase_13 AC 40 ms
51,968 KB
testcase_14 AC 39 ms
51,968 KB
testcase_15 AC 46 ms
59,904 KB
testcase_16 AC 488 ms
84,296 KB
testcase_17 AC 39 ms
51,840 KB
testcase_18 AC 60 ms
66,944 KB
testcase_19 AC 39 ms
51,968 KB
testcase_20 AC 47 ms
59,904 KB
testcase_21 AC 39 ms
51,968 KB
testcase_22 AC 59 ms
66,560 KB
testcase_23 AC 38 ms
51,840 KB
testcase_24 AC 233 ms
80,256 KB
testcase_25 WA -
testcase_26 AC 38 ms
51,968 KB
testcase_27 AC 67 ms
74,240 KB
testcase_28 AC 39 ms
51,968 KB
testcase_29 AC 57 ms
65,152 KB
testcase_30 AC 475 ms
84,336 KB
testcase_31 WA -
testcase_32 AC 101 ms
77,276 KB
testcase_33 AC 230 ms
80,428 KB
testcase_34 AC 252 ms
80,512 KB
testcase_35 AC 467 ms
84,352 KB
testcase_36 AC 38 ms
51,968 KB
testcase_37 WA -
testcase_38 AC 503 ms
84,480 KB
testcase_39 AC 86 ms
76,800 KB
testcase_40 AC 39 ms
51,584 KB
testcase_41 AC 80 ms
76,908 KB
testcase_42 AC 38 ms
51,840 KB
testcase_43 WA -
testcase_44 AC 38 ms
51,968 KB
testcase_45 AC 38 ms
52,096 KB
testcase_46 AC 39 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if sum(A) <= V:
    print('Draw')
    exit()

dp = [0]*(1<<N)
for bit in range(1<<N-1, -1, -1):
    tot = 0
    cnt = bin(bit).count('1')
    res = 1 if cnt % 2 else 2
    for i in range(N):
        if bit >> i & 1:
            tot += A[i]
        else:
            nb = bit|(1<<i)
            if cnt % 2:
                if dp[nb] == 2:
                    res = 2
            else:
                if dp[nb] == 1:
                    res = 1
    if tot > V:
        dp[bit] = 2 if cnt % 2 else 1
    else:
        dp[bit] = res
print('First' if dp[0] == 1 else 'Second')
0