Submission #389173

#TimeUsernameProblemLanguageResultExecution timeMemory
389173Ahmad_HasanCalvinball championship (CEOI15_teams)C++17
10 / 100
783 ms65540 KiB
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; vector<int>v(n); for(int i=0;i<n;i++) cin>>v[i]; int dp[n][n+5]; memset(dp,0,sizeof(dp)); for(int i=1;i<=n;i++) dp[n-1][i]=i-1; for(int i=n-2;i>=0;i--){ for(int j=2;j<=n;j++){ dp[i][j]=dp[i][j-1]; for(int k=i+1;k<n;k++){ dp[i][j]+=dp[k][j-1+(k-(i))]; } dp[i][j]++; } } /*** for(int i=0;i<n;i++){ for(int j=1;j<=n;j++) cout<<dp[i][j]<<' '; cout<<'\n'; }*/ int ans=0; for(int i=0;i<n;i++) ans+=dp[i][v[i]]; cout<<ans+1<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...