# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
834328 |
2023-08-22T13:04:23 Z |
Darren0724 |
Jump (BOI06_jump) |
C++17 |
|
7 ms |
5096 KB |
#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 |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
436 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
564 KB |
Output is correct |
8 |
Correct |
1 ms |
828 KB |
Output is correct |
9 |
Correct |
1 ms |
852 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
1 ms |
820 KB |
Output is correct |
12 |
Correct |
1 ms |
944 KB |
Output is correct |
13 |
Correct |
1 ms |
980 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Correct |
2 ms |
2260 KB |
Output is correct |
16 |
Correct |
4 ms |
3404 KB |
Output is correct |
17 |
Correct |
4 ms |
3664 KB |
Output is correct |
18 |
Correct |
7 ms |
4180 KB |
Output is correct |
19 |
Correct |
5 ms |
4436 KB |
Output is correct |
20 |
Correct |
7 ms |
5096 KB |
Output is correct |