結果

問題 No.2055 12x34...
ユーザー hourenhouren
提出日時 2022-08-23 02:29:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 171,344 KB
実行使用メモリ 25,472 KB
最終ジャッジ日時 2024-04-18 15:15:34
合計ジャッジ時間 6,430 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 AC 11 ms
6,940 KB
testcase_04 AC 16 ms
6,940 KB
testcase_05 AC 17 ms
6,940 KB
testcase_06 AC 15 ms
6,944 KB
testcase_07 AC 12 ms
6,944 KB
testcase_08 AC 9 ms
6,944 KB
testcase_09 AC 19 ms
6,944 KB
testcase_10 AC 19 ms
6,940 KB
testcase_11 AC 9 ms
6,940 KB
testcase_12 AC 142 ms
16,384 KB
testcase_13 AC 250 ms
24,576 KB
testcase_14 AC 83 ms
12,160 KB
testcase_15 AC 84 ms
12,544 KB
testcase_16 AC 259 ms
25,472 KB
testcase_17 AC 53 ms
6,944 KB
testcase_18 AC 108 ms
6,940 KB
testcase_19 AC 19 ms
6,940 KB
testcase_20 AC 8 ms
6,940 KB
testcase_21 AC 19 ms
6,940 KB
testcase_22 AC 146 ms
7,680 KB
testcase_23 AC 143 ms
11,392 KB
testcase_24 AC 86 ms
15,488 KB
testcase_25 AC 138 ms
12,672 KB
testcase_26 AC 120 ms
13,312 KB
testcase_27 AC 102 ms
15,744 KB
testcase_28 AC 109 ms
13,952 KB
testcase_29 AC 146 ms
15,232 KB
testcase_30 AC 122 ms
13,056 KB
testcase_31 AC 109 ms
12,800 KB
testcase_32 AC 108 ms
13,440 KB
testcase_33 AC 57 ms
6,944 KB
testcase_34 AC 59 ms
6,944 KB
testcase_35 AC 59 ms
6,940 KB
testcase_36 AC 59 ms
6,940 KB
testcase_37 AC 60 ms
6,944 KB
testcase_38 AC 57 ms
6,940 KB
testcase_39 AC 59 ms
6,940 KB
testcase_40 AC 59 ms
6,944 KB
testcase_41 AC 59 ms
6,940 KB
testcase_42 AC 59 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
const ll MOD = 998244353;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    map<int,ll> mp;
    ll ans = 0;
    rep(i,n){
        int a;
        cin >> a;
        ans = (ans + mp[a-1]) % MOD;
        mp[a] = (mp[a] + mp[a-1] + 1) % MOD;
    }
    cout << ans << '\n';
    return 0;
}
0