# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316337 | sofapuden | Jump (BOI06_jump) | C++14 | 37 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |