結果
| 問題 | No.1457 ツブ消ししとるなHard |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 22:03:14 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 863 bytes |
| 記録 | |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 82,196 KB |
| 実行使用メモリ | 100,528 KB |
| 最終ジャッジ日時 | 2024-12-15 18:45:17 |
| 合計ジャッジ時間 | 1,986 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 WA * 7 |
ソースコード
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
n,m,x,y,z = list(map(int, input().split()))
V = "Handicapped"
a = list(map(int, input().split()))
b = [a[i] for i in range(n) if a[i]>=x]
a = [a[i]-z for i in range(n) if x>a[i]>y]
if len(b)>m:
print(V)
else:
from collections import defaultdict
target = z*len(b) - sum(b)
dp = defaultdict(int)
dp[0,0] = 1
for i in range(len(a)):
v = a[i]
ndp = defaultdict(int)
for k,num in dp:
ndp[k,num] += dp[k,num]
ndp[k+v,num+1] += dp[k,num]
dp = ndp
# print(dp, v)
ans = 0
for k,num in dp:
if k==target and num<=m and (num - int(len(b)==0) > 0):
ans += dp[k,num]
print(ans)