結果
問題 | No.412 花火大会 |
ユーザー |
|
提出日時 | 2019-02-11 10:43:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 626 bytes |
コンパイル時間 | 610 ms |
コンパイル使用メモリ | 76,080 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 03:12:25 |
合計ジャッジ時間 | 1,312 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; typedef long long ll; int main(){ int a[3], n; for(int i = 0; i < 3; i++) cin >> a[i]; sort(a, a+3); cin >> n; int e[n]; for(int i = 0; i < n; i++) cin >> e[i]; sort(e, e+n); vector<ll> dp(4, 0); dp[0] = 1; for(int i = 0; i < n; i++){ vector<ll> next = dp; for(int j = 0; j < 3; j++){ if(e[i] >= a[j]) next[j+1] += dp[j]; else next[j] += dp[j]; } next[3] += dp[3]; dp = next; } cout << dp[3] << endl; return 0; }