結果

問題 No.2055 12x34...
ユーザー momoyuumomoyuu
提出日時 2022-08-22 01:01:59
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 962 bytes
コンパイル時間 4,007 ms
コンパイル使用メモリ 287,192 KB
実行使用メモリ 36,484 KB
最終ジャッジ日時 2024-04-18 13:15:58
合計ジャッジ時間 8,556 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 13 ms
6,940 KB
testcase_03 AC 30 ms
10,240 KB
testcase_04 AC 41 ms
12,992 KB
testcase_05 AC 45 ms
13,720 KB
testcase_06 AC 37 ms
12,564 KB
testcase_07 AC 32 ms
10,496 KB
testcase_08 AC 23 ms
8,448 KB
testcase_09 AC 48 ms
14,808 KB
testcase_10 AC 52 ms
15,780 KB
testcase_11 AC 21 ms
8,064 KB
testcase_12 AC 129 ms
22,784 KB
testcase_13 AC 240 ms
34,992 KB
testcase_14 AC 81 ms
16,512 KB
testcase_15 AC 86 ms
16,640 KB
testcase_16 AC 263 ms
36,484 KB
testcase_17 AC 63 ms
10,240 KB
testcase_18 AC 117 ms
16,000 KB
testcase_19 AC 26 ms
6,940 KB
testcase_20 AC 11 ms
6,944 KB
testcase_21 AC 26 ms
6,940 KB
testcase_22 AC 162 ms
19,904 KB
testcase_23 AC 147 ms
23,756 KB
testcase_24 AC 127 ms
27,600 KB
testcase_25 AC 140 ms
25,064 KB
testcase_26 AC 133 ms
25,344 KB
testcase_27 AC 132 ms
28,116 KB
testcase_28 AC 129 ms
26,136 KB
testcase_29 AC 150 ms
27,288 KB
testcase_30 AC 141 ms
25,196 KB
testcase_31 AC 135 ms
25,124 KB
testcase_32 AC 133 ms
25,612 KB
testcase_33 AC 80 ms
15,944 KB
testcase_34 AC 80 ms
15,928 KB
testcase_35 AC 82 ms
15,736 KB
testcase_36 AC 80 ms
15,736 KB
testcase_37 AC 83 ms
15,752 KB
testcase_38 AC 80 ms
15,744 KB
testcase_39 AC 81 ms
15,816 KB
testcase_40 AC 83 ms
15,788 KB
testcase_41 AC 80 ms
15,736 KB
testcase_42 AC 80 ms
15,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template<class t> using vc = vector<t>;
template<class t> using vvc = vc<vc<t>>;
using pi = pair<int,int>;
using vi = vc<int>;
using vvi = vvc<int>;

#define rep(i,a,b) for (int i = a; i < b; i++)
#define irep(i,a,b) for (int i = a; i > b; i--)
#define print(n) cout << n << endl
#define pritn(n) print(n)
#define rup(a,b) (a+b-1)/b
#define input(A,N) rep(i,0,N) cin>>A[i];


int main(){
    cout << fixed << setprecision(15);
    
    int N ;
    cin >> N;
    vc<ll> A(N);
    input(A,N);
    ll mod = 998244353;
    vvc<ll> dp(N,{0,0});
    map<ll,ll> d;

    ll count = 0;
    rep(i,0,N){
        dp[i][0] += d[A[i]-1];
        dp[i][0] %= mod;
        count += dp[i][0];
        count %= mod;
        if (i==N-1) break;
        dp[i][0] ++;
        d[A[i]] += dp[i][0];
    }
    print(count);
    //system("pause");
    return 0;
}
0