結果

問題 No.1457 ツブ消ししとるなHard
ユーザー nasubi24nasubi24
提出日時 2021-03-31 21:29:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 62,464 KB
最終ジャッジ日時 2024-05-09 05:28:13
合計ジャッジ時間 2,182 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
58,112 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 42 ms
52,224 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 41 ms
52,224 KB
testcase_08 AC 42 ms
52,096 KB
testcase_09 AC 48 ms
58,880 KB
testcase_10 AC 48 ms
59,008 KB
testcase_11 AC 46 ms
57,984 KB
testcase_12 AC 56 ms
61,056 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 52 ms
60,160 KB
testcase_16 WA -
testcase_17 AC 48 ms
58,880 KB
testcase_18 AC 41 ms
52,352 KB
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x,y,z=map(int,input().split())
a=list(map(int,input().split()))
cnt1=0
cnt2=0
b=[]
for i in range(n):
    if a[i]>=x:
        cnt1+=a[i]
        cnt2+=1
    elif a[i]>y:
        b.append(a[i])
s=50*len(b)+2
dp=[[0]*(5000) for _ in range(len(b)+1)]
dp[0][0]=1
for i in range(len(b)):
    c=b[i]
    for j in range(i,-1,-1):
        for k in range(s):
            if dp[j][k]!=0:
                dp[j+1][k+c]+=1
if cnt2>m:
    print("Handicapped")
else:
    ans=0
    for i in range(min(len(b),m-cnt2+1)):
        if z*(cnt2+i)-cnt1>=0:
            ans+=dp[i][z*(cnt2+i)-cnt1]
    print(ans)
0