結果
問題 |
No.2433 Min Increasing Sequence
|
ユーザー |
|
提出日時 | 2023-08-19 16:40:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 406 bytes |
コンパイル時間 | 1,980 ms |
コンパイル使用メモリ | 193,068 KB |
最終ジャッジ日時 | 2025-02-16 11:38:23 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; constexpr int mod=998244353; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vector<int>A(N); for(int &i:A)cin>>i; vector<int>dp(N+1); dp[N]=1; int l=N-1; for(int i=N-1;i>=0;i--){ if(A[l]>=A[i])l=i; dp[i]=dp[l+1]; dp[i]=(dp[i]+dp[i+1])%mod; } cout<<(dp[0]-dp[1]+mod)%mod<<'\n'; }