# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
531157 | sidon | Jump (BOI06_jump) | C++17 | 6 ms | 2128 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;
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 |
---|---|---|---|---|
Fetching results... |