結果
問題 |
No.2055 12x34...
|
ユーザー |
![]() |
提出日時 | 2022-08-29 22:07:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 283 ms / 2,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 3,505 ms |
コンパイル使用メモリ | 200,500 KB |
最終ジャッジ日時 | 2025-02-06 23:38:51 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; int A[200010]; cin >> N; for(int i = 0; i < N; i++) cin >> A[i]; map<int, long long> mp; long long ans = 0; for(int i = 0; i < N; i++){ ans += mp[A[i] - 1] + 1; mp[A[i]] += mp[A[i] - 1] + 1; ans %= 998244353; mp[A[i]] %= 998244353; } cout << (ans + 998244353 - N) % 998244353 << "\n"; }