Submission #531158

# Submission time Handle Problem Language Result Execution time Memory
531158 2022-02-27T21:49:47 Z sidon Jump (BOI06_jump) C++17
20 / 100
5 ms 972 KB
#include <bits/stdc++.h>
using namespace std;

void add(string &x, const string &y) {
	int cur = 0, j = size(y);

	for(int i = 0; i < j || cur; ++i) {
		if(i < j) cur += y[i] - '0';

		if(int(size(x)) == i) x.push_back('0');
		cur += x[i] - '0';
		x[i] = (cur % 10) + '0';
		cur /= 10;
	}
}
 
int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int n; cin >> n;
 
	int a[n][n];
	string b[n][n];
 
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			cin >> a[i][j];
			b[i][j] = "0";
		}
	}
 
	b[0][0] = "1";
 
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			if(i == n-1 && j == n-1) cout << string(b[i][j]);
 
			if(i + a[i][j] < n)	add(b[i + a[i][j]][j], b[i][j]);
			if(j + a[i][j] < n) add(b[i][j + a[i][j]], b[i][j]);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Incorrect 1 ms 332 KB Output isn't correct
10 Incorrect 1 ms 204 KB Output isn't correct
11 Incorrect 1 ms 332 KB Output isn't correct
12 Incorrect 0 ms 332 KB Output isn't correct
13 Incorrect 1 ms 332 KB Output isn't correct
14 Incorrect 1 ms 332 KB Output isn't correct
15 Incorrect 1 ms 460 KB Output isn't correct
16 Incorrect 3 ms 716 KB Output isn't correct
17 Incorrect 3 ms 588 KB Output isn't correct
18 Incorrect 4 ms 844 KB Output isn't correct
19 Incorrect 3 ms 716 KB Output isn't correct
20 Incorrect 5 ms 972 KB Output isn't correct