# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
462608 |
2021-08-11T00:06:40 Z |
JovanB |
Jump (BOI06_jump) |
C++17 |
|
12 ms |
3148 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int mat[205][205];
struct bigint{
vector <int> broj;
void output(){
int n = broj.size();
for(int i=n-1; i>=0; i--) cout << broj[i];
return;
}
bigint operator + (const bigint &a){
int n = broj.size();
int m = a.broj.size();
bigint res;
for(int i=0; i<max(n, m)+5; i++) res.broj.push_back(0);
for(int i=0; i<max(n, m)+1; i++){
if(i < n) res.broj[i] += broj[i];
if(i < m) res.broj[i] += a.broj[i];
res.broj[i+1] += res.broj[i]/10;
res.broj[i] %= 10;
}
while(res.broj[res.broj.size()-1] == 0 && res.broj.size() > 1) res.broj.pop_back();
return res;
}
} dp[205][205];
void output(bigint x){
int n = x.broj.size();
for(int i=n-1; i>=0; i--) cout << x.broj[i];
return;
}
int main(){
ios_base::sync_with_stdio(false);
cout.precision(10);
cout<<fixed;
int n;
cin >> n;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
cin >> mat[i][j];
}
}
dp[n][n].broj = {1};
for(int i=n; i>=1; i--){
for(int j=n; j>=1; j--){
if(i == n && j == n) continue;
dp[i][j] = dp[i][j] + dp[i+mat[i][j]][j];
dp[i][j] = dp[i][j] + dp[i][j+mat[i][j]];
}
}
output(dp[1][1]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1228 KB |
Output is correct |
2 |
Correct |
1 ms |
1228 KB |
Output is correct |
3 |
Correct |
2 ms |
1228 KB |
Output is correct |
4 |
Correct |
1 ms |
1300 KB |
Output is correct |
5 |
Correct |
1 ms |
1304 KB |
Output is correct |
6 |
Correct |
1 ms |
1228 KB |
Output is correct |
7 |
Correct |
2 ms |
1304 KB |
Output is correct |
8 |
Correct |
2 ms |
1356 KB |
Output is correct |
9 |
Correct |
3 ms |
1356 KB |
Output is correct |
10 |
Correct |
1 ms |
1300 KB |
Output is correct |
11 |
Correct |
1 ms |
1304 KB |
Output is correct |
12 |
Correct |
2 ms |
1356 KB |
Output is correct |
13 |
Correct |
2 ms |
1356 KB |
Output is correct |
14 |
Correct |
2 ms |
1356 KB |
Output is correct |
15 |
Correct |
4 ms |
1612 KB |
Output is correct |
16 |
Correct |
7 ms |
2336 KB |
Output is correct |
17 |
Correct |
8 ms |
1996 KB |
Output is correct |
18 |
Correct |
11 ms |
2636 KB |
Output is correct |
19 |
Correct |
11 ms |
2380 KB |
Output is correct |
20 |
Correct |
12 ms |
3148 KB |
Output is correct |