# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
531157 |
2022-02-27T21:45:35 Z |
sidon |
Jump (BOI06_jump) |
C++17 |
|
6 ms |
2128 KB |
#include <bits/stdc++.h>
using namespace std;
struct num {
vector<int> v;
num(int n = 0) : v({n}) {}
void operator+=(const num &x) {
int cur = 0, j = size(x.v);
for(int i = 0; i < j || cur; ++i) {
if(i < j) cur += x.v[i];
if(int(size(v)) == i) v.push_back(0);
cur += v[i];
v[i] = cur % 10;
cur /= 10;
}
}
void print() {
for(int i = size(v); i--; )
cout << v[i];
}
};
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n; cin >> n;
int a[n][n];
num b[n][n] {};
for(int i = 0; i < n; ++i)
for(int &j : a[i]) cin >> j;
b[0][0] = num(1);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
if(i == n-1 && j == n-1) b[i][j].print();
if(i + a[i][j] < n) b[i + a[i][j]][j] += b[i][j];
if(j + a[i][j] < n) b[i][j + a[i][j]] += b[i][j];
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
312 KB |
Output is correct |
7 |
Correct |
1 ms |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
704 KB |
Output is correct |
16 |
Correct |
4 ms |
1232 KB |
Output is correct |
17 |
Correct |
3 ms |
968 KB |
Output is correct |
18 |
Correct |
5 ms |
1600 KB |
Output is correct |
19 |
Correct |
4 ms |
1360 KB |
Output is correct |
20 |
Correct |
6 ms |
2128 KB |
Output is correct |