結果
問題 |
No.1457 ツブ消ししとるなHard
|
ユーザー |
|
提出日時 | 2021-11-12 10:54:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 338 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 26,428 KB |
最終ジャッジ日時 | 2024-11-24 19:42:07 |
合計ジャッジ時間 | 29,484 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 TLE * 7 |
ソースコード
from bisect import * N,M,X,Y,Z = map(int,input().split()) A = list(map(int,input().split())) y = bisect_right(A,Y) x = bisect_left(A,X) if N-x > M: print("Handicapped") exit(0) s = 2500 dp = [[0]*(s*2+100) for i in range(M+1)] dp[0][0] = 1 for a in A: nxt = [[0]*(s*2+100) for i in range(M+1)] for i in range(M+1): for j in range(-s,s+1): if i+1 <= M and Y < a and -s <= j+a-Z <= s: nxt[i+1][j+a-Z] += dp[i][j] if a < X: nxt[i][j] += dp[i][j] dp = nxt ans = 0 for i in range(1,M+1): ans += dp[i][0] print(ans)