Submission #834328

#TimeUsernameProblemLanguageResultExecution timeMemory
834328Darren0724Jump (BOI06_jump)C++17
100 / 100
7 ms5096 KiB
#include<bits/stdc++.h> using namespace std; const int K=110; int dp[K][K][K]{}; void add(int *a,int *b){ for(int i=0;i<K-1;i++){ a[i]+=b[i]; if(a[i]>9){ a[i]-=10; a[i+1]++; } } } int main(){ int n;cin>>n; dp[0][0][0]=1; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ int k;cin>>k; if(k==0)continue; add(dp[i+k][j],dp[i][j]); add(dp[i][j+k],dp[i][j]); } } int b=0; int t=K-1; while(t>=0){ b|=(dp[n-1][n-1][t]>0); if(b)cout<<dp[n-1][n-1][t]; t--; } if(!b)cout<<0; cout<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...