結果

問題 No.2433 Min Increasing Sequence
ユーザー noya2noya2
提出日時 2023-08-11 20:40:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 207,056 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-04-29 11:53:56
合計ジャッジ時間 5,650 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 85 ms
6,400 KB
testcase_05 AC 40 ms
5,376 KB
testcase_06 AC 70 ms
5,888 KB
testcase_07 AC 46 ms
5,376 KB
testcase_08 AC 78 ms
6,272 KB
testcase_09 AC 61 ms
5,376 KB
testcase_10 AC 29 ms
5,376 KB
testcase_11 AC 44 ms
5,376 KB
testcase_12 AC 27 ms
5,376 KB
testcase_13 AC 22 ms
5,376 KB
testcase_14 AC 56 ms
5,376 KB
testcase_15 AC 23 ms
5,376 KB
testcase_16 AC 29 ms
5,376 KB
testcase_17 AC 21 ms
5,376 KB
testcase_18 AC 82 ms
6,272 KB
testcase_19 AC 81 ms
6,144 KB
testcase_20 AC 6 ms
5,376 KB
testcase_21 AC 71 ms
5,760 KB
testcase_22 AC 79 ms
6,272 KB
testcase_23 AC 68 ms
5,888 KB
testcase_24 AC 81 ms
6,272 KB
testcase_25 AC 75 ms
6,016 KB
testcase_26 AC 59 ms
5,376 KB
testcase_27 AC 71 ms
5,888 KB
testcase_28 AC 64 ms
5,504 KB
testcase_29 AC 14 ms
5,376 KB
testcase_30 AC 14 ms
5,376 KB
testcase_31 AC 11 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<pair<int,int>> b(n+1);
    b[n].first = 1'000'000'001;
    vector<mint> dp(n+1,0);
    dp[n] = 1;
    for (int i = n-1; i >= 0; i--){
        if (b[i+1].first >= a[i]){
            b[i] = make_pair(a[i],i);
        }
        else {
            b[i] = b[i+1];
        }
        int l = b[i].second;
        mint cur = dp[l+1];
        dp[i] = dp[i+1] + cur;
        if (i == 0){
            cout << cur.val() << endl;
        }
    }
}
0