結果

問題 No.1457 ツブ消ししとるなHard
ユーザー sushitorunasushitoruna
提出日時 2021-03-27 01:14:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 175,672 KB
実行使用メモリ 54,400 KB
最終ジャッジ日時 2024-05-06 21:54:15
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
54,252 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 14 ms
54,260 KB
testcase_03 AC 14 ms
54,228 KB
testcase_04 AC 22 ms
54,240 KB
testcase_05 AC 21 ms
54,248 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 15 ms
54,252 KB
testcase_10 AC 14 ms
54,232 KB
testcase_11 AC 15 ms
54,264 KB
testcase_12 AC 18 ms
54,360 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 18 ms
54,128 KB
testcase_16 AC 17 ms
54,284 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 16 ms
54,236 KB
testcase_19 WA -
testcase_20 AC 14 ms
54,264 KB
権限があれば一括ダウンロードができます

ソースコード

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)
    {
      if(j==0)dp[i][j][k]=dp[i-1][j][k];
      else dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-v[i-1]];
    }
    ll ans=0;
    Rep(i,1,m+1)ans+=dp[n][i][z*i];
    cout<<ans<<endl;
}
0