# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
834328 | Darren0724 | Jump (BOI06_jump) | C++17 | 7 ms | 5096 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |