# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
495507 | chungdinh | Jump (BOI06_jump) | C++17 | 3 ms | 336 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 <iostream>
#include <stack>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
#include <math.h>
#include <map>
using namespace std;
#define cntbit(x) __builtin_popcount(x)
#define FOR(i,l,r) for (int i = l; i <= r; i++)
#define FORD(i,r,l) for (int i = r; i >= l; i--)
#define ll long long
#define ii pair<int, int>
#define MP make_pair
#define fi first
#define se second
const int N = 100 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
int n;
int g[N][N];
ll dp[N][N];
int main() {
cin >> n;
FOR(i,0,n-1) FOR(j,0,n-1) cin >> g[i][j];
dp[n - 1][n - 1] = 1;
FORD(i,n-1,0) FORD(j,n-1,0) {
if (g[i][j] == 0) continue;
if (i + g[i][j] < n) dp[i][j] += dp[i + g[i][j]][j];
if (j + g[i][j] < n) dp[i][j] += dp[i][j + g[i][j]];
}
cout << dp[0][0];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |