제출 #1210025

#제출 시각아이디문제언어결과실행 시간메모리
1210025i_love_springJump (BOI06_jump)C++20
70 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array void solve() { int n; cin >> n; vector<vector<int>> a(n + 1,vector<int>(n + 1)); vector<vector<ll>> dp(n + 1,vector<ll>(n + 1, 0)); for (int i = 1;i <= n;i++) { for (int j = 1; j <= n;j++) cin >> a[i][j]; } dp[1][1] = 1; for (int i = 1; i<= n;i++) { for (int j = 1; j <= n;j++) { if (a[i][j] == 0) continue; if (i + a[i][j] <= n) dp[i + a[i][j]][j] += dp[i][j]; if (j + a[i][j] <= n) dp[i][j + a[i][j]] += dp[i][j]; } } cout << dp[n][n]; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; // cin >> t; while (t--) { solve(); cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...