結果

問題 No.1861 Required Number
ユーザー 👑 KazunKazun
提出日時 2022-03-04 23:46:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 1,152 ms
コンパイル使用メモリ 86,616 KB
実行使用メモリ 329,588 KB
最終ジャッジ日時 2023-09-26 03:02:23
合計ジャッジ時間 12,575 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,216 KB
testcase_01 WA -
testcase_02 AC 79 ms
71,332 KB
testcase_03 AC 536 ms
315,048 KB
testcase_04 AC 532 ms
315,032 KB
testcase_05 AC 74 ms
71,200 KB
testcase_06 AC 76 ms
71,344 KB
testcase_07 AC 82 ms
76,244 KB
testcase_08 AC 83 ms
76,680 KB
testcase_09 WA -
testcase_10 AC 79 ms
76,056 KB
testcase_11 AC 81 ms
75,980 KB
testcase_12 WA -
testcase_13 AC 84 ms
76,268 KB
testcase_14 AC 83 ms
76,132 KB
testcase_15 AC 83 ms
76,228 KB
testcase_16 WA -
testcase_17 AC 82 ms
76,280 KB
testcase_18 AC 84 ms
75,952 KB
testcase_19 AC 82 ms
76,052 KB
testcase_20 AC 82 ms
76,052 KB
testcase_21 AC 81 ms
76,124 KB
testcase_22 AC 83 ms
76,056 KB
testcase_23 AC 79 ms
76,160 KB
testcase_24 AC 244 ms
178,244 KB
testcase_25 AC 475 ms
326,984 KB
testcase_26 AC 152 ms
110,236 KB
testcase_27 AC 217 ms
154,232 KB
testcase_28 AC 246 ms
177,612 KB
testcase_29 AC 174 ms
121,836 KB
testcase_30 AC 113 ms
82,984 KB
testcase_31 AC 484 ms
329,588 KB
testcase_32 AC 114 ms
82,896 KB
testcase_33 AC 341 ms
245,556 KB
testcase_34 AC 414 ms
300,788 KB
testcase_35 AC 430 ms
304,692 KB
testcase_36 AC 177 ms
123,544 KB
testcase_37 AC 247 ms
176,396 KB
testcase_38 AC 473 ms
309,136 KB
testcase_39 AC 273 ms
199,852 KB
testcase_40 AC 482 ms
328,780 KB
testcase_41 AC 461 ms
317,116 KB
testcase_42 AC 414 ms
288,184 KB
testcase_43 AC 253 ms
176,504 KB
testcase_44 AC 77 ms
71,304 KB
04_evil_1.txt RE -
04_evil_2.txt RE -
04_evil_3.txt RE -
04_evil_4.txt RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(A):
    DP=[[0]*(K+1) for _ in range(N+2)]
    DP[0][0]=1

    for i,a in enumerate(A,1):
        D=DP[i-1].copy()
        for y in range(K,a-1,-1):
            D[y]|=D[y-a]
        DP[i]=D
    DP[-1][0]=1
    return DP

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

assert (N<=10**4) and (K<=10**3)

X=f(A)
Y=f(A[::-1])[::-1]

Ans=0
for i in range(1,N+1):
    flag=1
    for x in range(K+1):
        flag&=~(X[i-1][x]&Y[i+1][K-x])
    Ans+=flag

print(Ans)
0