結果

問題 No.2055 12x34...
ユーザー umimelumimel
提出日時 2022-08-21 13:06:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 864 bytes
コンパイル時間 1,677 ms
コンパイル使用メモリ 175,768 KB
実行使用メモリ 48,580 KB
最終ジャッジ日時 2023-07-31 12:33:48
合計ジャッジ時間 9,806 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 12 ms
4,376 KB
testcase_03 AC 26 ms
4,376 KB
testcase_04 AC 34 ms
4,496 KB
testcase_05 AC 36 ms
4,436 KB
testcase_06 AC 33 ms
4,376 KB
testcase_07 AC 26 ms
4,376 KB
testcase_08 AC 19 ms
4,376 KB
testcase_09 AC 40 ms
4,380 KB
testcase_10 AC 43 ms
4,568 KB
testcase_11 AC 18 ms
4,376 KB
testcase_12 AC 304 ms
30,092 KB
testcase_13 AC 512 ms
46,540 KB
testcase_14 AC 189 ms
21,524 KB
testcase_15 AC 194 ms
21,528 KB
testcase_16 AC 541 ms
48,580 KB
testcase_17 AC 102 ms
7,396 KB
testcase_18 AC 203 ms
10,648 KB
testcase_19 AC 36 ms
4,780 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 AC 38 ms
4,948 KB
testcase_22 AC 274 ms
12,792 KB
testcase_23 AC 280 ms
20,600 KB
testcase_24 AC 176 ms
28,444 KB
testcase_25 AC 271 ms
23,412 KB
testcase_26 AC 245 ms
23,972 KB
testcase_27 AC 202 ms
29,504 KB
testcase_28 AC 225 ms
25,552 KB
testcase_29 AC 287 ms
27,804 KB
testcase_30 AC 249 ms
23,652 KB
testcase_31 AC 226 ms
23,124 KB
testcase_32 AC 223 ms
24,496 KB
testcase_33 AC 128 ms
4,632 KB
testcase_34 AC 131 ms
4,612 KB
testcase_35 AC 130 ms
4,580 KB
testcase_36 AC 128 ms
4,624 KB
testcase_37 AC 131 ms
4,696 KB
testcase_38 AC 128 ms
4,580 KB
testcase_39 AC 132 ms
4,696 KB
testcase_40 AC 131 ms
4,760 KB
testcase_41 AC 129 ms
4,572 KB
testcase_42 AC 130 ms
4,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1LL << 60;
const ll MAX_N = 2e5;

int main(){
    ll n;
    cin >> n;

    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    map<pll, ll> mp;
    rep(i, n){
        mp[{a[i], 0}]++;
        mp[{a[i], 0}] %= MOD2;
        mp[{a[i], 1}] += (mp[{a[i]-1, 0}] + mp[{a[i]-1, 1}])%MOD2;
        mp[{a[i], 1}] %= MOD2;
    }

    ll ans = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++){
        if((*itr).fi.se == 1){
            ans += (*itr).se;
            ans %= MOD2;
        }
    }

    cout << ans << endl;
}
0