結果

問題 No.412 花火大会
ユーザー トッティトッティ
提出日時 2021-02-06 02:57:09
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 1,118 ms
コンパイル使用メモリ 95,540 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-15 11:09:44
合計ジャッジ時間 1,733 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
#include <set>

int main() {
  std::vector<int> a(3);
  for (auto &e : a) {
    std::cin >> e;
  }
  std::sort(a.begin(), a.end());
  size_t n;
  std::cin >> n;
  std::vector<int> b(n);
  for (auto &e : b) {
    std::cin >> e;
  }
  std::sort(b.begin(), b.end());

  std::vector<std::vector<int>> dp(n + 1, std::vector<int>(4, 0));
  dp[0][0] = 1;
  for (size_t i = 1; i < n + 1; i++) for (size_t j = 0; j < 4; j++) {
    if (j < 3 && a[j] <= b[i]) {
      dp[i][j + 1] += dp[i - 1][j];
      dp[i][j] += dp[i - 1][j];
    } else {
      dp[i][j] += 2 * dp[i - 1][j];
    }
  }
  std::cout << dp[n][3] << std::endl;
}
0