結果

問題 No.412 花火大会
ユーザー btkbtk
提出日時 2016-08-12 23:05:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 898 bytes
コンパイル時間 1,697 ms
コンパイル使用メモリ 177,492 KB
実行使用メモリ 20,208 KB
最終ジャッジ日時 2023-08-07 12:31:41
合計ジャッジ時間 3,801 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
19,848 KB
testcase_01 AC 23 ms
19,840 KB
testcase_02 AC 25 ms
19,844 KB
testcase_03 AC 25 ms
19,840 KB
testcase_04 AC 15 ms
19,848 KB
testcase_05 AC 52 ms
19,888 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 16 ms
19,900 KB
testcase_09 AC 17 ms
19,952 KB
testcase_10 AC 24 ms
20,208 KB
testcase_11 AC 39 ms
19,920 KB
testcase_12 AC 38 ms
19,844 KB
testcase_13 AC 37 ms
19,956 KB
testcase_14 AC 39 ms
20,016 KB
testcase_15 AC 37 ms
19,900 KB
testcase_16 AC 39 ms
19,624 KB
testcase_17 AC 38 ms
20,164 KB
testcase_18 AC 111 ms
19,948 KB
testcase_19 AC 118 ms
19,844 KB
testcase_20 AC 120 ms
19,924 KB
testcase_21 AC 122 ms
19,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef vector<LL> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

int main(){
    int B,C,D,N;cin>>B>>C>>D>>N;
    vector<int> v({B,C,D});
    sort(v.begin(),v.end());
    B=v[0],C=v[1],D=v[2];
    VVV dp(101,VV(101,V(101,0)));
    dp[0][0][0]=1;
    for(int i=0;i<N;i++){
        int e;cin>>e;
        VVV nxt=dp;
        for(int b=0;b<=100;b++)
            for(int c=b;c<=100;c++)
                for(int d=c;d<=100;d++){
                    if(d<=e)nxt[c][d][e]+=dp[b][c][d];
                    else if(c<=e)nxt[c][e][d]+=dp[b][c][d];
                    else if(b<=e)nxt[e][c][d]+=dp[b][c][d];
                }
        swap(dp,nxt);
    }
    LL res=0;
    for(int b=B;b<=100;b++)
        for(int c=C;c<=100;c++)
            for(int d=D;d<=100;d++)
                res+=dp[b][c][d];
    cout<<res<<endl;
    return 0;
}
0