結果

問題 No.1457 ツブ消ししとるなHard
ユーザー auauaauaua
提出日時 2021-04-01 17:32:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 1,473 bytes
コンパイル時間 1,587 ms
コンパイル使用メモリ 174,292 KB
実行使用メモリ 55,148 KB
最終ジャッジ日時 2023-08-22 20:11:52
合計ジャッジ時間 2,960 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,484 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 52 ms
55,044 KB
testcase_05 AC 48 ms
51,072 KB
testcase_06 AC 53 ms
55,148 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 7 ms
8,932 KB
testcase_10 AC 7 ms
8,832 KB
testcase_11 AC 4 ms
5,256 KB
testcase_12 AC 30 ms
31,948 KB
testcase_13 AC 10 ms
11,828 KB
testcase_14 AC 3 ms
5,020 KB
testcase_15 AC 12 ms
14,140 KB
testcase_16 AC 11 ms
13,172 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 48 ms
49,804 KB
testcase_20 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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>(2501)));
    dp[0][cnt][sum]=1;
    rep(i,l){
        rep(j,m+1){
            rep(k,2501){
                if(j<m&&k+b[i]<2501)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,2501){
            if(k==j*z)ans+=dp[l][j][k];
        }
    }
    cout<<ans<<endl;
}
0