結果

問題 No.2055 12x34...
ユーザー HIcoderHIcoder
提出日時 2023-07-11 18:17:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 277 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 1,135 ms
コンパイル使用メモリ 111,432 KB
実行使用メモリ 27,204 KB
最終ジャッジ日時 2023-10-11 09:24:21
合計ジャッジ時間 6,889 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 10 ms
4,352 KB
testcase_03 AC 21 ms
4,352 KB
testcase_04 AC 30 ms
4,856 KB
testcase_05 AC 31 ms
4,896 KB
testcase_06 AC 28 ms
4,884 KB
testcase_07 AC 22 ms
4,372 KB
testcase_08 AC 15 ms
4,408 KB
testcase_09 AC 33 ms
5,124 KB
testcase_10 AC 36 ms
5,476 KB
testcase_11 AC 15 ms
4,348 KB
testcase_12 AC 158 ms
17,412 KB
testcase_13 AC 270 ms
26,220 KB
testcase_14 AC 89 ms
12,676 KB
testcase_15 AC 92 ms
12,884 KB
testcase_16 AC 277 ms
27,204 KB
testcase_17 AC 71 ms
5,684 KB
testcase_18 AC 138 ms
8,056 KB
testcase_19 AC 25 ms
4,352 KB
testcase_20 AC 9 ms
4,348 KB
testcase_21 AC 26 ms
4,372 KB
testcase_22 AC 188 ms
9,916 KB
testcase_23 AC 173 ms
13,404 KB
testcase_24 AC 116 ms
17,440 KB
testcase_25 AC 160 ms
14,788 KB
testcase_26 AC 150 ms
14,876 KB
testcase_27 AC 133 ms
17,896 KB
testcase_28 AC 139 ms
15,856 KB
testcase_29 AC 174 ms
16,996 KB
testcase_30 AC 154 ms
14,604 KB
testcase_31 AC 138 ms
14,716 KB
testcase_32 AC 133 ms
15,248 KB
testcase_33 AC 81 ms
5,404 KB
testcase_34 AC 81 ms
5,376 KB
testcase_35 AC 81 ms
5,476 KB
testcase_36 AC 81 ms
5,412 KB
testcase_37 AC 81 ms
5,472 KB
testcase_38 AC 80 ms
5,428 KB
testcase_39 AC 83 ms
5,692 KB
testcase_40 AC 81 ms
5,548 KB
testcase_41 AC 78 ms
5,360 KB
testcase_42 AC 81 ms
5,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
const double PI=acos(-1);

int main(){
    int N;
    cin>>N;
    map<int,ll> mp;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    vector<ll> dp(N+1,0);

    ll ans=0;
    for(int i=0;i<N;i++){
        ans+=(mp[A[i]-1]+1)%MOD;//i番目から始めることに対する1通り
        ans%=MOD;
        mp[A[i]]+=(mp[A[i]-1]+1)%MOD;
        mp[A[i]]%=MOD;
    }

    ans-=N;
    ans+=MOD;
    ans%=MOD;
    cout<<ans<<endl;
}
0