結果

問題 No.412 花火大会
ユーザー kk
提出日時 2021-03-03 22:01:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 650 bytes
コンパイル時間 2,177 ms
コンパイル使用メモリ 199,300 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-27 00:37:15
合計ジャッジ時間 4,102 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int dp[101][1<<3];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  vector<int> x(3);
  for (int i = 0; i < 3; i++)
    cin >> x[i];

  int n;
  cin >> n;

  vector<int> y(n);
  for (int i = 0; i < n; i++)
    cin >> y[i];

  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 1<<3; j++) {
      int jt = j;
      for (int k = 0; k < 3; k++) {
        if (!(j & 1 << k) && y[i] >= x[k]) {
          jt |= 1 << k;
          break;
        }
      }
      dp[i+1][j] += dp[i][j];
      dp[i+1][jt] += dp[i][j];
    }
  }

  cout << dp[n][0b111] << endl;
  
  return 0;
}
0