結果
| 問題 | 
                            No.1457 ツブ消ししとるなHard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             auaua
                         | 
                    
| 提出日時 | 2021-04-01 17:32:18 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,469 bytes | 
| コンパイル時間 | 1,837 ms | 
| コンパイル使用メモリ | 175,176 KB | 
| 実行使用メモリ | 8,576 KB | 
| 最終ジャッジ日時 | 2024-12-17 21:21:52 | 
| 合計ジャッジ時間 | 2,547 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 9 WA * 8 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=998244353;
const ll inf=INF*INF;
const ll mod=MOD;
const ll MAX=2000010;
signed main(){
    ll n,m,x,y,z;cin>>n>>m>>x>>y>>z;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    vector<ll>b(0);
    ll sum=0,cnt=0;
    rep(i,n){
        if(a[i]<=y)continue;
        else if(a[i]>=x){
            sum+=a[i];
            cnt++;
        }else{
            b.pb(a[i]);
        }
    }
    if(cnt>m){
        cout<<"Handicapped"<<endl;
        return 0;
    }
    ll l=b.size();
    vector<vector<vector<ll> > >dp(l+1,vector<vector<ll> >(m+1,vector<ll>(251)));
    dp[0][cnt][sum]=1;
    rep(i,l){
        rep(j,m+1){
            rep(k,251){
                if(j<m&&k+b[i]<251)dp[i+1][j+1][k+b[i]]+=dp[i][j][k];
                dp[i+1][j][k]+=dp[i][j][k];
            }
        }
    }
    ll ans=0;
    rep(j,m+1){
        REP(k,1,251){
            if(k==j*z)ans+=dp[l][j][k];
        }
    }
    cout<<ans<<endl;
}
            
            
            
        
            
auaua