結果

問題 No.2055 12x34...
ユーザー BenriBot_ccbsBenriBot_ccbs
提出日時 2022-08-28 17:42:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 169,388 KB
実行使用メモリ 22,644 KB
最終ジャッジ日時 2024-04-23 15:18:33
合計ジャッジ時間 6,527 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 12 ms
6,944 KB
testcase_03 AC 23 ms
6,944 KB
testcase_04 AC 32 ms
6,944 KB
testcase_05 AC 34 ms
6,940 KB
testcase_06 AC 31 ms
6,940 KB
testcase_07 AC 24 ms
6,940 KB
testcase_08 AC 18 ms
6,944 KB
testcase_09 AC 38 ms
6,944 KB
testcase_10 AC 41 ms
6,940 KB
testcase_11 AC 17 ms
6,944 KB
testcase_12 AC 90 ms
12,668 KB
testcase_13 AC 158 ms
16,536 KB
testcase_14 AC 55 ms
9,080 KB
testcase_15 AC 58 ms
9,208 KB
testcase_16 AC 188 ms
22,644 KB
testcase_17 AC 43 ms
6,944 KB
testcase_18 AC 77 ms
6,940 KB
testcase_19 AC 19 ms
6,944 KB
testcase_20 AC 8 ms
6,940 KB
testcase_21 AC 19 ms
6,940 KB
testcase_22 AC 102 ms
6,944 KB
testcase_23 AC 81 ms
8,568 KB
testcase_24 AC 94 ms
12,796 KB
testcase_25 AC 85 ms
9,208 KB
testcase_26 AC 82 ms
9,336 KB
testcase_27 AC 92 ms
12,816 KB
testcase_28 AC 85 ms
9,720 KB
testcase_29 AC 91 ms
12,652 KB
testcase_30 AC 85 ms
9,332 KB
testcase_31 AC 87 ms
9,204 KB
testcase_32 AC 85 ms
9,464 KB
testcase_33 AC 53 ms
6,944 KB
testcase_34 AC 55 ms
6,944 KB
testcase_35 AC 55 ms
6,940 KB
testcase_36 AC 53 ms
6,940 KB
testcase_37 AC 53 ms
6,940 KB
testcase_38 AC 53 ms
6,944 KB
testcase_39 AC 53 ms
6,940 KB
testcase_40 AC 54 ms
6,940 KB
testcase_41 AC 51 ms
6,940 KB
testcase_42 AC 51 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll mod = 998244353;

int main(){
    ll N;
    cin >> N;
    unordered_map<ll,ll> dp; //iで終わる階差1の等差数列の個数
    
    ll ans=0;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        ans += dp[a-1]%mod; // 追加した分だけをansに+=
        dp[a] += 1+dp[a-1];//(a)と(...,a-1,a)を新たに追加
        dp[a] %= mod;
    }
    
    cout << ans%mod;
}
0