結果

問題 No.2055 12x34...
ユーザー umimelumimel
提出日時 2022-08-21 13:06:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 503 ms / 2,000 ms
コード長 864 bytes
コンパイル時間 1,701 ms
コンパイル使用メモリ 174,320 KB
実行使用メモリ 48,768 KB
最終ジャッジ日時 2024-04-18 12:48:55
合計ジャッジ時間 9,213 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 12 ms
5,376 KB
testcase_03 AC 25 ms
5,376 KB
testcase_04 AC 34 ms
5,376 KB
testcase_05 AC 35 ms
5,376 KB
testcase_06 AC 32 ms
5,376 KB
testcase_07 AC 26 ms
5,376 KB
testcase_08 AC 20 ms
5,376 KB
testcase_09 AC 41 ms
5,376 KB
testcase_10 AC 42 ms
5,376 KB
testcase_11 AC 17 ms
5,376 KB
testcase_12 AC 299 ms
30,208 KB
testcase_13 AC 492 ms
46,848 KB
testcase_14 AC 178 ms
21,376 KB
testcase_15 AC 170 ms
21,504 KB
testcase_16 AC 503 ms
48,768 KB
testcase_17 AC 98 ms
7,296 KB
testcase_18 AC 190 ms
10,752 KB
testcase_19 AC 35 ms
5,376 KB
testcase_20 AC 13 ms
5,376 KB
testcase_21 AC 36 ms
5,376 KB
testcase_22 AC 254 ms
13,056 KB
testcase_23 AC 257 ms
20,736 KB
testcase_24 AC 162 ms
28,672 KB
testcase_25 AC 253 ms
23,424 KB
testcase_26 AC 226 ms
24,064 KB
testcase_27 AC 185 ms
29,568 KB
testcase_28 AC 210 ms
25,600 KB
testcase_29 AC 265 ms
28,160 KB
testcase_30 AC 239 ms
23,680 KB
testcase_31 AC 234 ms
23,424 KB
testcase_32 AC 224 ms
24,576 KB
testcase_33 AC 119 ms
5,376 KB
testcase_34 AC 128 ms
5,376 KB
testcase_35 AC 125 ms
5,376 KB
testcase_36 AC 123 ms
5,376 KB
testcase_37 AC 123 ms
5,376 KB
testcase_38 AC 120 ms
5,376 KB
testcase_39 AC 127 ms
5,376 KB
testcase_40 AC 120 ms
5,376 KB
testcase_41 AC 117 ms
5,376 KB
testcase_42 AC 123 ms
5,376 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