結果
問題 |
No.2792 Security Cameras on Young Diagram
|
ユーザー |
![]() |
提出日時 | 2024-06-29 01:23:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 2,938 ms |
コンパイル使用メモリ | 245,552 KB |
実行使用メモリ | 10,096 KB |
最終ジャッジ日時 | 2024-06-29 01:23:37 |
合計ジャッジ時間 | 6,351 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 9 RE * 10 |
ソースコード
#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() int main() { int n; cin>>n; int A[n]; rep(i,n){cin>>A[i];} LL 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]; } } LL ans=1; for(int i=1;i<=A[0];i++){ans+=dp[0][i];} cout<<ans<<endl; }