結果
| 問題 |
No.2055 12x34...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-08 18:31:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 252 ms / 2,000 ms |
| コード長 | 510 bytes |
| コンパイル時間 | 1,486 ms |
| コンパイル使用メモリ | 177,620 KB |
| 実行使用メモリ | 26,624 KB |
| 最終ジャッジ日時 | 2024-09-27 19:39:16 |
| 合計ジャッジ時間 | 7,006 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
map<ll, ll> cnt;
ll n, ans = 0;
cin >> n;
vector<ll> a(n);
for (auto& x : a) cin >> x;
for (ll i = 0; i < n; i++) {
cnt[a[i]]++;
cnt[a[i]] += cnt[a[i] - 1];
cnt[a[i]] %= mod;
}
for (auto& i : cnt) ans = (ans + i.second) % mod;
ans = (ans + mod - n) % mod;
cout << ans << '\n';
}