結果

問題 No.2055 12x34...
ユーザー nonon
提出日時 2024-09-23 22:54:58
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 7,865 ms
コンパイル使用メモリ 254,384 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2024-09-23 23:00:11
合計ジャッジ時間 15,266 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    map<int, mint> dp;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        dp[A] += dp[A - 1] + 1;
    }
    mint ans = -N;
    for (auto [key, val] : dp) ans += val;
    cout << ans.val() << endl;
}
0