結果
| 問題 |
No.2792 Security Cameras on Young Diagram
|
| コンテスト | |
| ユーザー |
はるお味
|
| 提出日時 | 2024-06-29 01:31:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 767 bytes |
| コンパイル時間 | 3,023 ms |
| コンパイル使用メモリ | 247,740 KB |
| 実行使用メモリ | 814,440 KB |
| 最終ジャッジ日時 | 2024-06-29 01:31:49 |
| 合計ジャッジ時間 | 6,382 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 RE * 7 MLE * 1 -- * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<VL> VVL;
typedef long long LL;
#define all(a) (a).begin(), (a).end()
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define ALL(a) (a).begin(),(a).end()
#include <atcoder/modint>
using mint = atcoder::modint998244353;
int main() {
int n; cin>>n;
int A[n];
rep(i,n){cin>>A[i];}
mint dp[n][A[0]+1]={};
rep(i,A[n-1]){dp[n-1][i+1]=1;}
for(int i=n-2;i>=0;i--){
dp[i][A[i]]=1+dp[i+1][A[i]];
for(int j=A[i]-1;j>=1;j--){
dp[i][j]=dp[i][j+1]+dp[i+1][j];
}
}
mint ans=1;
for(int i=1;i<=A[0];i++){ans+=dp[0][i];}
cout<<ans.val()<<endl;
}
はるお味