結果

問題 No.1457 ツブ消ししとるなHard
ユーザー ああいいああいい
提出日時 2022-06-03 07:50:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 933 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 94,848 KB
最終ジャッジ日時 2023-10-21 01:25:40
合計ジャッジ時間 2,712 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
61,896 KB
testcase_01 AC 36 ms
53,516 KB
testcase_02 WA -
testcase_03 AC 33 ms
53,512 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 36 ms
53,516 KB
testcase_08 AC 33 ms
53,516 KB
testcase_09 AC 54 ms
70,112 KB
testcase_10 AC 54 ms
70,112 KB
testcase_11 AC 46 ms
65,992 KB
testcase_12 AC 94 ms
79,360 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 72 ms
76,576 KB
testcase_16 AC 73 ms
77,828 KB
testcase_17 AC 34 ms
53,516 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,X,Y,Z = map(int,input().split())
A = list(map(int,input().split()))

l = []
count = 0
s = 0
for a in A:
    if a >= X:
        count += 1
        s += a - Z
    elif a > Y:
        l.append(a - Z)
n = len(l)
import sys
if count > M:
    print('Handicapped')
    exit()
if count == M:
    if s == 0:
        print(1)
    else:
        print(0)
    exit()
    
C = 2500 + 10
base = 2500 + 5
dp = [[0] * (2 * C) for _ in range(M - count + 1)]
dp[0][base + s] = 1
for i in range(n):
    a = l[i]
    nx = [[0] * (2 * C) for _ in range(M - count + 1)]
    for j in range(M - count):
        u = dp[j]
        v = nx[j + 1]
        for k in range(2 * C):
            if 0 <= k + a < 2 * C:
                v[k + a] += u[k]
    for j in range(1 + M - count):
        u = dp[j]
        v = nx[j]
        for k in range(2 * C):
            v[k] += u[k]
    dp = nx
ans = 0
for j in range(M - count + 1):
    ans += dp[j][base]
print(ans)
0