結果
| 問題 | No.1457 ツブ消ししとるなHard |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-26 11:21:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 784 bytes |
| 記録 | |
| コンパイル時間 | 1,894 ms |
| コンパイル使用メモリ | 179,036 KB |
| 実行使用メモリ | 49,920 KB |
| 最終ジャッジ日時 | 2024-11-29 08:13:53 |
| 合計ジャッジ時間 | 2,675 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
int N,M,X,Y,Z;
cin>>N>>M>>X>>Y>>Z;
int cnt=0;
vector<int>A(N);
for(int i=0;i<N;i++){
cin>>A[i];
if(A[i]>=X)cnt++;
}
if(cnt>M){
puts("Handicapped");
return 0;
}
vector<vector<vector<ll>>>dp(N+1,vector<vector<ll>>(M+1,vector<ll>(M*Z+1)));
dp[0][0][0]=1;
for(int i=0;i<N;i++){
if(A[i]<X){
dp[i+1]=dp[i];
}
if(A[i]>Y){
for(int j=0;j<M;j++){
for(int k=0;k+A[i]<=M*Z;k++){
dp[i+1][j+1][k+A[i]]+=dp[i][j][k];
}
}
}
}
ll ans=0;
for(int i=1;i<=M;i++){
ans+=dp[N][i][i*Z];
}
cout<<ans<<endl;
}