結果
問題 |
No.2055 12x34...
|
ユーザー |
![]() |
提出日時 | 2022-08-22 15:48:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 166 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 2,097 ms |
コンパイル使用メモリ | 203,256 KB |
最終ジャッジ日時 | 2025-01-31 02:47:36 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#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; }