結果

問題 No.2055 12x34...
ユーザー 👑 CleyL
提出日時 2022-08-21 19:16:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 78,696 KB
最終ジャッジ日時 2025-01-31 02:33:57
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
const long long MOD = 998244353;
int main(){
    int n;cin>>n;
    map<int,long long> A;
    for(int i = 0; n > i; i++){
        int x;cin>>x;
        A[x]=(A[x]+1+A[x-1])%MOD;
    }
    long long ans = MOD-n;
    for(auto x: A){
        ans = (ans+x.second)%MOD;
    }
    cout << ans << endl;
    
}
0