# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
495507 | chungdinh | Jump (BOI06_jump) | C++17 | 3 ms | 336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |