結果

問題 No.1861 Required Number
ユーザー shiomusubi496shiomusubi496
提出日時 2022-03-02 10:22:07
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 456 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 849,088 KB
最終ジャッジ日時 2023-09-26 03:02:08
合計ジャッジ時間 5,956 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,288 KB
testcase_01 AC 73 ms
71,292 KB
testcase_02 AC 70 ms
71,288 KB
testcase_03 AC 81 ms
76,788 KB
testcase_04 AC 81 ms
76,636 KB
testcase_05 AC 71 ms
71,324 KB
testcase_06 AC 71 ms
71,552 KB
testcase_07 AC 68 ms
71,248 KB
testcase_08 AC 70 ms
71,292 KB
testcase_09 AC 71 ms
71,588 KB
testcase_10 AC 70 ms
71,496 KB
testcase_11 AC 68 ms
71,248 KB
testcase_12 AC 70 ms
71,520 KB
testcase_13 AC 70 ms
71,292 KB
testcase_14 AC 70 ms
71,276 KB
testcase_15 AC 71 ms
71,416 KB
testcase_16 AC 70 ms
71,440 KB
testcase_17 AC 70 ms
71,272 KB
testcase_18 AC 68 ms
71,316 KB
testcase_19 AC 70 ms
71,368 KB
testcase_20 AC 70 ms
71,500 KB
testcase_21 AC 70 ms
71,288 KB
testcase_22 AC 70 ms
71,492 KB
testcase_23 AC 70 ms
71,340 KB
testcase_24 MLE -
testcase_25 MLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
04_evil_1.txt -- -
04_evil_2.txt -- -
04_evil_3.txt -- -
04_evil_4.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dpl = [0 for _ in range(N + 1)]
dpr = [0 for _ in range(N + 1)]
dpl[0] = 1
dpr[N] = (1 << K)

for i in range(N):
    dpl[i + 1] = dpl[i] | (dpl[i] << A[i])
for i in range(N - 1, -1, -1):
    dpr[i] = dpr[i + 1] | (dpr[i + 1] >> A[i])
if (dpl[N] & (1 << K)) == 0:
    print(-1)
else:
    ans = N
    for i in range(N):
        if dpl[i] & dpr[i + 1]:
            ans -= 1
    print(ans)
0