結果

問題 No.1457 ツブ消ししとるなHard
ユーザー sushitorunasushitoruna
提出日時 2021-03-27 00:57:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 765 bytes
コンパイル時間 1,881 ms
コンパイル使用メモリ 176,048 KB
実行使用メモリ 54,388 KB
最終ジャッジ日時 2024-05-06 21:53:41
合計ジャッジ時間 5,078 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
54,144 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 RE -
testcase_03 AC 16 ms
54,312 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 16 ms
54,388 KB
testcase_10 AC 24 ms
54,144 KB
testcase_11 AC 18 ms
54,272 KB
testcase_12 AC 20 ms
54,272 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 18 ms
54,344 KB
testcase_16 AC 17 ms
54,296 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;using ll=long long;
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
ll dp[51][51][2501];
int main()
{
    ll n,m,x,y,z,cnt=0,sum=0;
    cin>>n>>m>>x>>y>>z;
    vector<ll>v;
    rep(i,n)
    {
        ll a;
        cin>>a;
        if(a>y)v.push_back(a);
        if(a>=x)cnt++,sum+=a;
    }
    if(cnt>m)
    {
        cout<<"Handicapped"<<endl;return 0;
    }
    sort(v.rbegin(),v.rend());
    rep(i,51)rep(j,51)rep(k,2501)
    {
        dp[i][j][k]=0;
    }
    dp[cnt][cnt][sum]=1;
    n=v.size();
    Rep(i,cnt+1,n+1)Rep(j,cnt,n+1)rep(k,2501)
    {
        dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-v[i-1]];
    }
    ll ans=0;
    rep(i,m+1)ans+=dp[n][i][z*i];
    cout<<ans<<endl;
}
0