結果

問題 No.1861 Required Number
ユーザー horitaka1999horitaka1999
提出日時 2022-03-05 00:17:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 839 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 237,380 KB
最終ジャッジ日時 2023-09-26 04:09:48
合計ジャッジ時間 30,576 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,808 KB
testcase_01 WA -
testcase_02 AC 90 ms
71,680 KB
testcase_03 AC 906 ms
237,124 KB
testcase_04 AC 911 ms
237,380 KB
testcase_05 AC 89 ms
71,572 KB
testcase_06 AC 91 ms
71,396 KB
testcase_07 AC 105 ms
77,496 KB
testcase_08 AC 114 ms
78,116 KB
testcase_09 WA -
testcase_10 AC 118 ms
77,832 KB
testcase_11 AC 120 ms
77,684 KB
testcase_12 WA -
testcase_13 AC 117 ms
77,752 KB
testcase_14 AC 109 ms
77,608 KB
testcase_15 AC 122 ms
77,640 KB
testcase_16 WA -
testcase_17 AC 119 ms
77,556 KB
testcase_18 AC 119 ms
77,996 KB
testcase_19 AC 119 ms
78,168 KB
testcase_20 AC 119 ms
78,228 KB
testcase_21 AC 118 ms
77,708 KB
testcase_22 AC 118 ms
78,176 KB
testcase_23 AC 114 ms
77,500 KB
testcase_24 AC 461 ms
131,500 KB
testcase_25 AC 914 ms
215,088 KB
testcase_26 AC 262 ms
100,116 KB
testcase_27 AC 409 ms
123,028 KB
testcase_28 AC 467 ms
134,368 KB
testcase_29 AC 323 ms
110,024 KB
testcase_30 AC 158 ms
85,372 KB
testcase_31 AC 924 ms
215,184 KB
testcase_32 AC 189 ms
89,844 KB
testcase_33 AC 671 ms
168,972 KB
testcase_34 AC 776 ms
190,564 KB
testcase_35 AC 782 ms
192,116 KB
testcase_36 AC 309 ms
112,176 KB
testcase_37 AC 453 ms
131,976 KB
testcase_38 AC 790 ms
192,144 KB
testcase_39 AC 497 ms
141,592 KB
testcase_40 AC 927 ms
214,848 KB
testcase_41 AC 868 ms
208,376 KB
testcase_42 AC 740 ms
183,688 KB
testcase_43 AC 463 ms
133,684 KB
testcase_44 AC 91 ms
71,680 KB
04_evil_1.txt TLE -
04_evil_2.txt TLE -
04_evil_3.txt TLE -
04_evil_4.txt MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,K = map(int,input().split())
ldp = [[False] * (K+1) for _ in range(N+2)]
ldp[0][0] = True
rdp = [[False] * (K+1) for _ in range(N+2)]
rdp[N+1][0] = True
INF = float('inf')
MIN = [INF for _ in range(K+1)]
MAX = [0 for _ in range(K+1)]

A = [0] + list(map(int,input().split()))
for i in range(1,N+1):
    for k in range(K+1):
        ldp[i][k] |= ldp[i-1][k]
        if k >= A[i]:
            ldp[i][k] |= ldp[i-1][k-A[i]]
for i in reversed(range(1,N+1)):
    for k in range(K+1):
        rdp[i][k] |= rdp[i+1][k]
        if k >= A[i]:
            rdp[i][k] |= rdp[i+1][k-A[i]]
if ldp[N][K]:
    cnt = 0
    for i in range(1,N+1):
        flag = True
        for x in range(K+1):
            if ldp[i-1][x] and rdp[i+1][K-x]:
                flag = False
        cnt += flag
    print(cnt)
else:
    print(0)
0