結果

問題 No.2055 12x34...
ユーザー StstoneStstone
提出日時 2022-10-15 17:54:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 751 ms / 2,000 ms
コード長 1,336 bytes
コンパイル時間 3,378 ms
コンパイル使用メモリ 234,520 KB
実行使用メモリ 55,776 KB
最終ジャッジ日時 2023-09-09 02:56:51
合計ジャッジ時間 11,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 7 ms
4,376 KB
testcase_03 AC 14 ms
4,376 KB
testcase_04 AC 18 ms
4,376 KB
testcase_05 AC 20 ms
4,380 KB
testcase_06 AC 18 ms
4,380 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 22 ms
4,376 KB
testcase_10 AC 23 ms
4,380 KB
testcase_11 AC 10 ms
4,380 KB
testcase_12 AC 402 ms
34,684 KB
testcase_13 AC 712 ms
53,640 KB
testcase_14 AC 250 ms
24,244 KB
testcase_15 AC 252 ms
24,588 KB
testcase_16 AC 751 ms
55,776 KB
testcase_17 AC 73 ms
8,148 KB
testcase_18 AC 159 ms
12,204 KB
testcase_19 AC 24 ms
5,292 KB
testcase_20 AC 8 ms
4,380 KB
testcase_21 AC 24 ms
5,368 KB
testcase_22 AC 225 ms
14,884 KB
testcase_23 AC 263 ms
25,252 KB
testcase_24 AC 220 ms
36,332 KB
testcase_25 AC 259 ms
29,244 KB
testcase_26 AC 243 ms
29,884 KB
testcase_27 AC 225 ms
37,452 KB
testcase_28 AC 243 ms
32,076 KB
testcase_29 AC 298 ms
35,312 KB
testcase_30 AC 248 ms
29,244 KB
testcase_31 AC 235 ms
28,896 KB
testcase_32 AC 235 ms
30,748 KB
testcase_33 AC 99 ms
4,380 KB
testcase_34 AC 100 ms
4,376 KB
testcase_35 AC 99 ms
4,376 KB
testcase_36 AC 100 ms
4,380 KB
testcase_37 AC 102 ms
4,376 KB
testcase_38 AC 100 ms
4,376 KB
testcase_39 AC 102 ms
4,380 KB
testcase_40 AC 101 ms
4,376 KB
testcase_41 AC 101 ms
4,376 KB
testcase_42 AC 99 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define bug(x) cerr << (x) << '\n'
#define yn(x) cout << (x==1?"Yes\n":"No\n")
#define PI 3.14159265358979323
#define Ststone ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const ll max_n=2e5+20,max_int=2147483647,mod1=1e9+7,mod2=998244353;
ll dx[8] = {1,0,0,-1,1,1,-1,-1};
ll dy[8] = {0,1,-1,0,1,-1,1,-1};
ll t,n,q,m,k,a,b,c,d,e,f,x,sum;
map<ll,ll> ans,knt;
vector<ll> v,v1,v2;
set<ll> se;
char cc;

void solve(){
    ans[0] = 0;
    cin >> n;
    for(ll i=0;i<n;i++){
        cin >> a;
        se.insert(a);
        knt[a] = knt[a]+1;
        ans[a] = (ans[a]+ans[a-1]+knt[a-1])%998244353;
    }
    ll cnt = 0;
    for(auto i:se){
        cnt = (cnt+ans[i])%998244353;
    }
    cout << cnt;
}



int main(){
    Ststone;/*
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #else
    #endif*/
    //cin >> t;
    t = 1;
    for(ll i=1;i<=t;i++){
        //cout << "Case #"<<i<<": ";
        solve();
    }
}

/*
*/
0