結果

問題 No.2055 12x34...
ユーザー ripityripity
提出日時 2022-10-31 23:33:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 206,344 KB
実行使用メモリ 23,724 KB
最終ジャッジ日時 2023-09-22 20:28:41
合計ジャッジ時間 8,648 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 10 ms
4,376 KB
testcase_03 AC 21 ms
4,376 KB
testcase_04 AC 30 ms
4,380 KB
testcase_05 AC 31 ms
4,644 KB
testcase_06 AC 28 ms
4,380 KB
testcase_07 AC 22 ms
4,408 KB
testcase_08 AC 16 ms
4,380 KB
testcase_09 AC 34 ms
4,376 KB
testcase_10 AC 37 ms
4,700 KB
testcase_11 AC 16 ms
4,376 KB
testcase_12 AC 90 ms
13,556 KB
testcase_13 AC 153 ms
17,696 KB
testcase_14 AC 58 ms
9,356 KB
testcase_15 AC 58 ms
9,316 KB
testcase_16 AC 179 ms
23,724 KB
testcase_17 AC 38 ms
4,904 KB
testcase_18 AC 69 ms
6,704 KB
testcase_19 AC 17 ms
4,380 KB
testcase_20 AC 7 ms
4,376 KB
testcase_21 AC 17 ms
4,380 KB
testcase_22 AC 89 ms
7,184 KB
testcase_23 AC 78 ms
9,932 KB
testcase_24 AC 87 ms
14,220 KB
testcase_25 AC 80 ms
10,596 KB
testcase_26 AC 79 ms
10,804 KB
testcase_27 AC 87 ms
14,288 KB
testcase_28 AC 80 ms
11,072 KB
testcase_29 AC 86 ms
13,968 KB
testcase_30 AC 79 ms
10,632 KB
testcase_31 AC 79 ms
10,640 KB
testcase_32 AC 80 ms
10,860 KB
testcase_33 AC 47 ms
4,640 KB
testcase_34 AC 48 ms
4,584 KB
testcase_35 AC 48 ms
4,764 KB
testcase_36 AC 48 ms
4,720 KB
testcase_37 AC 47 ms
4,632 KB
testcase_38 AC 48 ms
4,720 KB
testcase_39 AC 47 ms
4,660 KB
testcase_40 AC 48 ms
4,884 KB
testcase_41 AC 47 ms
4,672 KB
testcase_42 AC 47 ms
4,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    constexpr int P = 998244353;
    cin >> N;
    vector<int> A(N), dp(N, 1);
    unordered_map<int, int> dp_sum;
    for( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    for( int i = 0; i < N; i++ ) {
        dp[i] += dp_sum[A[i]-1];
        dp_sum[A[i]] += dp[i]%P;
        dp_sum[A[i]] %= P;
    }
    int ans = P-N;
    for( auto& [key, value] : dp_sum ) {
        ans += value;
        ans %= P;
    }
    cout << ans << endl;
}
0