結果

問題 No.412 花火大会
ユーザー tossytossy
提出日時 2016-09-19 21:57:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,172 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 95,692 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 16:26:55
合計ジャッジ時間 1,550 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

int dp[101][5];

int main(){
  vector<int> sz(3);
  while(cin>>sz[0]>>sz[1]>>sz[2]){
    int n;
    cin>>n;
    vector<int> vec(n);
    rep(i,n) scanf("%d", &vec[i]);

    sort(all(sz), greater<int>());
    sort(all(vec),greater<int>());

    fill(dp[0], dp[101], 0);

    // dp[i][j] : i番目までで,j個とる場合の数.ただしj>=3はすべて3とする.
    rep(i,n)dp[i][0]=1;
    dp[0][1] = (vec[0]>=sz[0])?1:0;
    repl(i,1,n){
      repl(j,1,4){
        dp[i][j] = dp[i-1][j];
        if(vec[i]>=sz[j-1]) dp[i][j] += dp[i-1][j-1];
      }
      dp[i][3] += dp[i-1][3];
    }

    cout<<dp[n-1][3]<<endl;
  }

  return 0;
}
0