結果
問題 | No.412 花火大会 |
ユーザー |
![]() |
提出日時 | 2018-06-28 17:45:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,441 bytes |
コンパイル時間 | 789 ms |
コンパイル使用メモリ | 85,588 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 23:30:18 |
合計ジャッジ時間 | 1,520 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <string> #include <cmath> #include <map> #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for(int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define Cout(obj) cout << obj << endl #define Size(obj) (int)(obj).size() #define fcout cout << fixed << setprecision(10) #define fi first #define se second using namespace std; using ll = long long int; using P = pair<int, int>; using T = tuple<int, int, int>; using edge = struct { int to, cost; }; const int MOD = 1e9 + 7; const int iINF = 1e9; const long long int llINF = 1e18; const double PI = acos(-1.0); const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int dp[50][4]; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<int> fam(3); REP(i, 3) cin >> fam[i]; int N; cin >> N; vector<int> E(N); REP(i, N) { cin >> E[i]; } sort(ALL(fam)); sort(ALL(E)); dp[0][0] = 1; REP(i, N) { REP(j, 4) { if(j < 3 && fam[j] <= E[i]) { dp[i + 1][j + 1] += dp[i][j]; dp[i + 1][j] += dp[i][j]; } else { dp[i + 1][j] += 2 * dp[i][j]; } } } Cout(dp[N][3]); return 0; }