結果

問題 No.2055 12x34...
ユーザー umezoumezo
提出日時 2022-08-22 15:48:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 206,532 KB
実行使用メモリ 17,280 KB
最終ジャッジ日時 2024-04-18 13:25:26
合計ジャッジ時間 7,262 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 7 ms
5,376 KB
testcase_03 AC 14 ms
5,376 KB
testcase_04 AC 17 ms
5,376 KB
testcase_05 AC 19 ms
5,376 KB
testcase_06 AC 17 ms
5,376 KB
testcase_07 AC 14 ms
5,376 KB
testcase_08 AC 10 ms
5,376 KB
testcase_09 AC 20 ms
5,376 KB
testcase_10 AC 23 ms
5,376 KB
testcase_11 AC 10 ms
5,376 KB
testcase_12 AC 76 ms
10,624 KB
testcase_13 AC 141 ms
15,104 KB
testcase_14 AC 46 ms
8,192 KB
testcase_15 AC 47 ms
8,192 KB
testcase_16 AC 153 ms
15,616 KB
testcase_17 AC 63 ms
5,504 KB
testcase_18 AC 130 ms
7,680 KB
testcase_19 AC 22 ms
5,376 KB
testcase_20 AC 9 ms
5,376 KB
testcase_21 AC 23 ms
5,376 KB
testcase_22 AC 174 ms
8,960 KB
testcase_23 AC 175 ms
12,928 KB
testcase_24 AC 99 ms
16,896 KB
testcase_25 AC 165 ms
13,952 KB
testcase_26 AC 143 ms
14,592 KB
testcase_27 AC 117 ms
17,280 KB
testcase_28 AC 134 ms
15,232 KB
testcase_29 AC 177 ms
16,384 KB
testcase_30 AC 147 ms
14,336 KB
testcase_31 AC 133 ms
14,080 KB
testcase_32 AC 131 ms
14,848 KB
testcase_33 AC 76 ms
5,376 KB
testcase_34 AC 75 ms
5,376 KB
testcase_35 AC 74 ms
5,376 KB
testcase_36 AC 75 ms
5,376 KB
testcase_37 AC 77 ms
5,376 KB
testcase_38 AC 74 ms
5,376 KB
testcase_39 AC 76 ms
5,376 KB
testcase_40 AC 74 ms
5,376 KB
testcase_41 AC 74 ms
5,376 KB
testcase_42 AC 74 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  map<ll,ll> dp;
  rep(i,n){
    dp[A[i]]++;
    if(dp.count(A[i]-1)) dp[A[i]]=(dp[A[i]]+dp[A[i]-1])%MOD;
  }
  ll ans=0;
  for(auto [a,b]:dp) ans=(ans+b)%MOD;
  ans=(ans-n+MOD)%MOD;
  cout<<ans<<endl;
  
  return 0;
}
0