結果

問題 No.1457 ツブ消ししとるなHard
ユーザー hiro71687khiro71687k
提出日時 2023-08-26 23:34:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,499 bytes
コンパイル時間 4,629 ms
コンパイル使用メモリ 265,512 KB
実行使用メモリ 66,740 KB
最終ジャッジ日時 2023-08-26 23:34:42
合計ジャッジ時間 6,688 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,232 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 3 ms
4,956 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 16 ms
20,300 KB
testcase_11 AC 4 ms
6,452 KB
testcase_12 AC 69 ms
66,400 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 31 ms
40,568 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=1009999999999999990;
int main(){
    ll n,m,x,y,z;
    cin >> n >> m >> x >> y >> z;
    vector<ll>a(n);
    vector<ll>b;
    ll now=0;
    ll ko=0;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i]>=x)
        {
            now+=a[i];
            ko++;
        }else{
            if (a[i]<=y)
            {
                continue;
            }
            b.push_back(a[i]);
        }
    }
    if (ko>m)
    {
        cout << "Handicapped" << endl;
        return 0;
    }
    ll nn=b.size();
    if (nn==0)
    {
        if (ko*z==now)
        {
            cout << 1 << endl;
        }else{
            cout << 0 << endl;
        }
        return 0;
    }
    vector<vector<vector<ll>>>dp(n,vector<vector<ll>>(n+3,vector<ll>(3000,0)));
    dp[0][ko][now]=1;
    dp[0][ko+1][b[0]+now]=1;
    for (ll i = 1; i < nn; i++)
    {
        for (ll j = 0; j <= m; j++)
        {
            for (ll k = 0; k < 2900; k++)
            {
                dp[i][j][k]+=dp[i-1][j][k];
                dp[i][j+1][k+b[i]]+=dp[i-1][j][k];
            }
        }
    }
    ll ans=0;
    for (ll i = 1; i <=m; i++)
    {
        for (ll j = 0; j <=50; j++)
        {
            if (i*z==j)
            {
                ans+=dp[nn-1][i][j];
            }
        }
    }
    cout << ans << endl;
}
0