結果

問題 No.1267 Stop and Coin Game
ユーザー chineristACchineristAC
提出日時 2020-10-24 01:53:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 860 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 109,776 KB
最終ジャッジ日時 2023-09-28 19:59:45
合計ジャッジ時間 10,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,580 KB
testcase_01 AC 75 ms
71,380 KB
testcase_02 AC 75 ms
71,504 KB
testcase_03 AC 74 ms
71,280 KB
testcase_04 AC 75 ms
71,204 KB
testcase_05 AC 84 ms
76,708 KB
testcase_06 AC 81 ms
76,472 KB
testcase_07 AC 74 ms
71,480 KB
testcase_08 AC 128 ms
80,876 KB
testcase_09 AC 80 ms
76,640 KB
testcase_10 AC 625 ms
109,512 KB
testcase_11 AC 216 ms
85,336 KB
testcase_12 AC 114 ms
77,756 KB
testcase_13 AC 74 ms
71,376 KB
testcase_14 AC 75 ms
71,472 KB
testcase_15 AC 87 ms
76,604 KB
testcase_16 AC 772 ms
109,748 KB
testcase_17 AC 76 ms
71,436 KB
testcase_18 AC 95 ms
76,584 KB
testcase_19 AC 76 ms
71,316 KB
testcase_20 AC 83 ms
76,476 KB
testcase_21 AC 76 ms
71,384 KB
testcase_22 AC 96 ms
76,732 KB
testcase_23 AC 75 ms
71,500 KB
testcase_24 AC 229 ms
93,280 KB
testcase_25 AC 458 ms
93,264 KB
testcase_26 AC 74 ms
71,436 KB
testcase_27 AC 90 ms
77,728 KB
testcase_28 AC 76 ms
71,468 KB
testcase_29 AC 92 ms
76,772 KB
testcase_30 AC 489 ms
109,560 KB
testcase_31 AC 96 ms
76,716 KB
testcase_32 AC 113 ms
80,660 KB
testcase_33 AC 211 ms
93,068 KB
testcase_34 AC 382 ms
93,176 KB
testcase_35 AC 469 ms
109,776 KB
testcase_36 AC 74 ms
71,544 KB
testcase_37 AC 175 ms
81,020 KB
testcase_38 AC 860 ms
109,708 KB
testcase_39 AC 138 ms
79,052 KB
testcase_40 AC 74 ms
71,472 KB
testcase_41 AC 139 ms
78,712 KB
testcase_42 AC 75 ms
71,548 KB
testcase_43 AC 181 ms
80,804 KB
testcase_44 AC 75 ms
71,376 KB
testcase_45 AC 74 ms
71,312 KB
testcase_46 AC 77 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if s<=V:
    print("Draw")
    exit()

dp_f = [0 for i in range(2**N)]
dp_s = [0 for i in range(2**N)]

for i in range(2**N):
    tmp = V - s
    for j in range(N):
        if i>>j &1:
            tmp += A[j]
    if tmp<0:
        dp_f[i] = "First"
        dp_s[i] = "Second"
    else:
        for j in range(N):
            if i>>j & 1:
                if dp_s[i-2**j]=="First":
                    dp_f[i] = "First"
                if dp_f[i-2**j]=="Second":
                    dp_s[i] = "Second"
        if not dp_f[i]:
            dp_f[i] = "Second"
        if not dp_s[i]:
            dp_s[i] = "First"

print(dp_f[-1])
0