結果

問題 No.2055 12x34...
ユーザー CAT_CATCAT_CAT
提出日時 2022-08-21 14:07:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 4,729 ms
コンパイル使用メモリ 263,192 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-04-18 12:57:20
合計ジャッジ時間 10,740 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 14 ms
6,016 KB
testcase_03 AC 27 ms
9,472 KB
testcase_04 AC 37 ms
11,788 KB
testcase_05 AC 39 ms
12,416 KB
testcase_06 AC 36 ms
11,520 KB
testcase_07 AC 29 ms
9,796 KB
testcase_08 AC 21 ms
7,780 KB
testcase_09 AC 43 ms
13,440 KB
testcase_10 AC 47 ms
14,068 KB
testcase_11 AC 20 ms
7,400 KB
testcase_12 AC 141 ms
15,488 KB
testcase_13 AC 254 ms
23,064 KB
testcase_14 AC 86 ms
11,392 KB
testcase_15 AC 90 ms
11,648 KB
testcase_16 AC 267 ms
23,936 KB
testcase_17 AC 82 ms
9,580 KB
testcase_18 AC 160 ms
14,748 KB
testcase_19 AC 30 ms
5,760 KB
testcase_20 AC 12 ms
5,376 KB
testcase_21 AC 31 ms
6,016 KB
testcase_22 AC 213 ms
18,560 KB
testcase_23 AC 203 ms
22,144 KB
testcase_24 AC 148 ms
26,352 KB
testcase_25 AC 195 ms
23,424 KB
testcase_26 AC 178 ms
23,764 KB
testcase_27 AC 161 ms
26,624 KB
testcase_28 AC 169 ms
24,576 KB
testcase_29 AC 207 ms
25,856 KB
testcase_30 AC 182 ms
23,572 KB
testcase_31 AC 169 ms
23,544 KB
testcase_32 AC 168 ms
24,064 KB
testcase_33 AC 93 ms
14,208 KB
testcase_34 AC 94 ms
14,232 KB
testcase_35 AC 94 ms
14,168 KB
testcase_36 AC 93 ms
14,268 KB
testcase_37 AC 95 ms
14,208 KB
testcase_38 AC 93 ms
14,208 KB
testcase_39 AC 96 ms
14,464 KB
testcase_40 AC 94 ms
14,324 KB
testcase_41 AC 95 ms
14,344 KB
testcase_42 AC 95 ms
14,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
#define int long long
#define double long double
using namespace std;
int size(int number){
    string numstr=to_string(number);
    return numstr.size();
}
constexpr int MOD=998244353;
signed main(void){
    int N;
    cin>>N;
    vector<int>A(N);
    for(int i=0;i<N;++i){
        cin>>A.at(i);
    }
    vector<map<int,int>>dp(N);
    dp.at(0)[A.at(0)]=1;
    for(int i=1;i<N;++i){
        dp.at(i)=move(dp.at(i-1));
        if(dp.at(i).find(A.at(i)-1)!=dp.at(i).end()){
            dp.at(i)[A.at(i)]+=dp.at(i)[A.at(i)-1]+1;
            dp.at(i)[A.at(i)]%=MOD;
        }else{
            dp.at(i)[A.at(i)]+=1;
            dp.at(i)[A.at(i)]%=MOD;
        }
    }
    int ans=0;
    for(auto e:dp.at(N-1)){
        ans+=e.second;
        ans%=MOD;
    }
    cout<<(ans-A.size())%MOD<<endl;

}

 
0