結果

問題 No.2055 12x34...
ユーザー mmn15277198mmn15277198
提出日時 2022-08-26 00:19:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 1,776 ms
コンパイル使用メモリ 171,416 KB
実行使用メモリ 25,984 KB
最終ジャッジ日時 2024-04-21 06:17:13
合計ジャッジ時間 7,923 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 10 ms
5,376 KB
testcase_03 AC 21 ms
5,376 KB
testcase_04 AC 31 ms
5,376 KB
testcase_05 AC 31 ms
5,376 KB
testcase_06 AC 29 ms
5,376 KB
testcase_07 AC 22 ms
5,376 KB
testcase_08 AC 17 ms
5,376 KB
testcase_09 AC 34 ms
5,376 KB
testcase_10 AC 40 ms
5,376 KB
testcase_11 AC 15 ms
5,376 KB
testcase_12 AC 147 ms
16,768 KB
testcase_13 AC 250 ms
25,216 KB
testcase_14 AC 88 ms
12,316 KB
testcase_15 AC 90 ms
12,464 KB
testcase_16 AC 263 ms
25,984 KB
testcase_17 AC 71 ms
5,524 KB
testcase_18 AC 146 ms
7,168 KB
testcase_19 AC 28 ms
5,376 KB
testcase_20 AC 11 ms
5,376 KB
testcase_21 AC 28 ms
5,376 KB
testcase_22 AC 188 ms
8,192 KB
testcase_23 AC 173 ms
12,032 KB
testcase_24 AC 118 ms
15,872 KB
testcase_25 AC 163 ms
13,312 KB
testcase_26 AC 144 ms
13,824 KB
testcase_27 AC 139 ms
16,384 KB
testcase_28 AC 140 ms
14,336 KB
testcase_29 AC 179 ms
15,616 KB
testcase_30 AC 149 ms
13,440 KB
testcase_31 AC 143 ms
13,312 KB
testcase_32 AC 140 ms
13,952 KB
testcase_33 AC 79 ms
5,376 KB
testcase_34 AC 80 ms
5,376 KB
testcase_35 AC 81 ms
5,376 KB
testcase_36 AC 77 ms
5,376 KB
testcase_37 AC 82 ms
5,376 KB
testcase_38 AC 78 ms
5,376 KB
testcase_39 AC 79 ms
5,376 KB
testcase_40 AC 81 ms
5,376 KB
testcase_41 AC 77 ms
5,376 KB
testcase_42 AC 76 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0