Submission #316337

#TimeUsernameProblemLanguageResultExecution timeMemory
316337sofapudenJump (BOI06_jump)C++14
60 / 100
37 ms384 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<vector<int>> gr(n,vector<int>(n)); vector<vector<int>> dp(n,vector<int>(n,0)); dp[0][0] = 1; for(auto &x : gr)for(auto &y : x)cin >> y; for(int i = 0; i < n; ++i){ for(int j = 0; j < n; ++j){ if(gr[i][j] + i < n && gr[i][j] != 0)dp[i+gr[i][j]][j]+=dp[i][j]; if(gr[i][j] + j < n && gr[i][j] != 0)dp[i][j+gr[i][j]]+=dp[i][j]; } } cout << dp[n-1][n-1] << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...