제출 #1347806

#제출 시각아이디문제언어결과실행 시간메모리
1347806BlockOGJump (BOI06_jump)C++20
70 / 100
0 ms344 KiB
#include <bits/stdc++.h>

// mrrrowwww meeowwwww :3
// go play vivid/stasis! !! !!! https://vividstasis.gay

#define fo(i, a, b) for (auto i = (a); i < (b); i++)
#define of(i, a, b) for (auto i = (b); i-- > (a);)
#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define be(a) a.begin(), a.end()
using namespace std;

int ____init = []{
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    return 0;
}();

int jump[100][100];
long long dp[100][100];

int main() {
    int n; cin >> n;
    fo(i, 0, n) fo(j, 0, n) cin >> jump[i][j];

    dp[0][0] = 1;
    fo(i, 0, n) fo(j, 0, n) {
        if (jump[i][j] <= 0) continue;
        if (i + jump[i][j] < n) dp[i + jump[i][j]][j] += dp[i][j];
        if (j + jump[i][j] < n) dp[i][j + jump[i][j]] += dp[i][j];
    }

    cout << dp[n - 1][n - 1];
}
#Verdict Execution timeMemoryGrader output
Fetching results...