답안 #495507

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495507 2021-12-19T07:55:20 Z chungdinh Jump (BOI06_jump) C++17
70 / 100
3 ms 336 KB
#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];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 308 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Incorrect 1 ms 336 KB Output isn't correct
16 Incorrect 1 ms 336 KB Output isn't correct
17 Incorrect 1 ms 316 KB Output isn't correct
18 Incorrect 1 ms 312 KB Output isn't correct
19 Incorrect 2 ms 336 KB Output isn't correct
20 Incorrect 3 ms 336 KB Output isn't correct