結果

問題 No.412 花火大会
ユーザー btkbtk
提出日時 2016-08-12 23:05:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 898 bytes
コンパイル時間 2,660 ms
コンパイル使用メモリ 175,872 KB
実行使用メモリ 20,224 KB
最終ジャッジ日時 2024-04-25 06:20:55
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
20,096 KB
testcase_01 AC 28 ms
19,968 KB
testcase_02 AC 33 ms
19,968 KB
testcase_03 AC 31 ms
19,968 KB
testcase_04 AC 17 ms
19,968 KB
testcase_05 AC 65 ms
19,968 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 18 ms
19,968 KB
testcase_09 AC 21 ms
19,968 KB
testcase_10 AC 32 ms
20,224 KB
testcase_11 AC 48 ms
20,096 KB
testcase_12 AC 50 ms
19,968 KB
testcase_13 AC 46 ms
19,968 KB
testcase_14 AC 46 ms
19,968 KB
testcase_15 AC 50 ms
20,096 KB
testcase_16 AC 48 ms
19,968 KB
testcase_17 AC 47 ms
19,968 KB
testcase_18 AC 143 ms
19,968 KB
testcase_19 AC 148 ms
20,096 KB
testcase_20 AC 140 ms
19,968 KB
testcase_21 AC 157 ms
19,968 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