結果

問題 No.1457 ツブ消ししとるなHard
ユーザー chocoruskchocorusk
提出日時 2021-03-31 22:28:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 1,394 bytes
コンパイル時間 3,393 ms
コンパイル使用メモリ 187,880 KB
実行使用メモリ 52,196 KB
最終ジャッジ日時 2023-08-22 02:50:14
合計ジャッジ時間 4,828 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
11,656 KB
testcase_01 AC 2 ms
7,452 KB
testcase_02 AC 2 ms
7,536 KB
testcase_03 AC 2 ms
7,532 KB
testcase_04 AC 15 ms
52,132 KB
testcase_05 AC 14 ms
50,480 KB
testcase_06 AC 16 ms
52,128 KB
testcase_07 AC 15 ms
52,144 KB
testcase_08 AC 7 ms
27,940 KB
testcase_09 AC 7 ms
27,892 KB
testcase_10 AC 7 ms
27,940 KB
testcase_11 AC 3 ms
11,508 KB
testcase_12 AC 15 ms
52,196 KB
testcase_13 AC 7 ms
27,996 KB
testcase_14 AC 7 ms
27,904 KB
testcase_15 AC 10 ms
40,244 KB
testcase_16 AC 15 ms
52,176 KB
testcase_17 AC 7 ms
27,944 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 15 ms
52,188 KB
testcase_20 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
ll dp[51][51][2501];
int main()
{
    int n, m, x, y, z;
    cin>>n>>m>>x>>y>>z;
    int a[55];
    for(int i=0; i<n; i++) cin>>a[i];
    dp[0][0][0]=1;
    for(int i=0; i<n; i++){
        for(int j=0; j<=i; j++){
            for(int k=0; k<=i*50; k++){
                if(a[i]>y){
                    dp[i+1][j+1][k+a[i]]+=dp[i][j][k];
                }
                if(a[i]<x){
                    dp[i+1][j][k]+=dp[i][j][k];
                }
            }
        }
    }
    ll ans=0;
    bool ok=0;
    for(int i=1; i<=m; i++){
        for(int j=0; j<=m*50; j++){
            if(dp[n][i][j]) ok=1;
        }
    }
    if(!ok){
        cout<<"Handicapped"<<endl;
        return 0;
    }
    for(int i=1; i<=m; i++){
        ans+=dp[n][i][i*z];
    }
    cout<<ans<<endl;
    return 0;
}
0