結果

問題 No.2055 12x34...
ユーザー hiro71687khiro71687k
提出日時 2024-02-12 15:03:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 4,376 ms
コンパイル使用メモリ 270,144 KB
実行使用メモリ 26,752 KB
最終ジャッジ日時 2024-02-12 15:03:36
合計ジャッジ時間 11,607 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 12 ms
6,676 KB
testcase_03 AC 24 ms
6,676 KB
testcase_04 AC 33 ms
6,676 KB
testcase_05 AC 50 ms
6,676 KB
testcase_06 AC 33 ms
6,676 KB
testcase_07 AC 26 ms
6,676 KB
testcase_08 AC 19 ms
6,676 KB
testcase_09 AC 39 ms
6,676 KB
testcase_10 AC 42 ms
6,676 KB
testcase_11 AC 17 ms
6,676 KB
testcase_12 AC 147 ms
17,280 KB
testcase_13 AC 253 ms
25,856 KB
testcase_14 AC 92 ms
12,672 KB
testcase_15 AC 93 ms
12,800 KB
testcase_16 AC 292 ms
26,752 KB
testcase_17 AC 76 ms
6,676 KB
testcase_18 AC 151 ms
7,680 KB
testcase_19 AC 28 ms
6,676 KB
testcase_20 AC 11 ms
6,676 KB
testcase_21 AC 29 ms
6,676 KB
testcase_22 AC 202 ms
9,088 KB
testcase_23 AC 186 ms
12,800 KB
testcase_24 AC 128 ms
16,896 KB
testcase_25 AC 187 ms
14,208 KB
testcase_26 AC 162 ms
14,592 KB
testcase_27 AC 142 ms
17,280 KB
testcase_28 AC 150 ms
15,232 KB
testcase_29 AC 189 ms
16,512 KB
testcase_30 AC 166 ms
14,336 KB
testcase_31 AC 153 ms
14,208 KB
testcase_32 AC 150 ms
14,848 KB
testcase_33 AC 87 ms
6,676 KB
testcase_34 AC 88 ms
6,676 KB
testcase_35 AC 88 ms
6,676 KB
testcase_36 AC 88 ms
6,676 KB
testcase_37 AC 89 ms
6,676 KB
testcase_38 AC 88 ms
6,676 KB
testcase_39 AC 89 ms
6,676 KB
testcase_40 AC 89 ms
6,676 KB
testcase_41 AC 89 ms
6,676 KB
testcase_42 AC 88 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=1000000000000000001;//10^17
int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    map<ll,ll>memo;
    ll ans=0;
    for (ll i = 0; i < n; i++)
    {
        ans+=memo[a[i]-1];
        memo[a[i]]+=memo[a[i]-1]+1;
        ans%=mod;
        memo[a[i]]%=mod;
    }
    cout << ans << endl;
}
0