結果

問題 No.412 花火大会
ユーザー ふーらくたるふーらくたる
提出日時 2016-08-13 01:04:40
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 690 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 51,608 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-07 12:06:11
合計ジャッジ時間 1,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

const int MAX_N = 40;

int demand[3], e[MAX_N];
int dp[MAX_N][5];

int main() {
    for (int i = 0; i < 3; i++) {
        cin >> demand[i];
    }

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> e[i];
    }

    dp[0][0] = 1;
    for (int s_i = 0; s_i < n; s_i++) {
        for (int cond = 0; cond <= 3; cond++) {
            dp[s_i + 1][cond] += dp[s_i][cond];
            if (cond < 3 && e[s_i] >= demand[cond]) {
                dp[s_i + 1][cond + 1] += dp[s_i][cond];
            } else {
                dp[s_i + 1][cond] += dp[s_i][cond];
            }
        }
    }
    cout << dp[n][3] << endl;

    return 0;
}
0