結果
| 問題 |
No.2055 12x34...
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2022-08-26 00:19:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 305 ms / 2,000 ms |
| コード長 | 401 bytes |
| コンパイル時間 | 1,680 ms |
| コンパイル使用メモリ | 176,276 KB |
| 実行使用メモリ | 25,984 KB |
| 最終ジャッジ日時 | 2024-10-13 04:56:06 |
| 合計ジャッジ時間 | 8,431 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int main() {
int n;
cin >> n;
vector<int> a(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];
ans %= mod;
mp[a[i]] += mp[a[i] - 1] + 1;
mp[a[i]] %= mod;
}
cout << ans << endl;
return 0;
}
mmn15277198