# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
758711 | Unforgettablepl | Jump (BOI06_jump) | C++17 | 1 ms | 468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define f first
#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;
const ll modulo = 1e4;
//#define int ll
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("input.in","r",stdin);
// freopen("haybales.out","w",stdout);
ll n;
cin >> n;
vector<vector<ll>> arr(n,vector<ll>(n));
vector<vector<ll>> DP(n,vector<ll>(n));
DP[0][0]=1;
for(auto&i:arr)for(ll&j:i)cin>>j;
for (ll i = 0; i < n; i++) { // i is row
for (ll j = 0; j < n; j++) { // j is column
if(arr[i][j]==0)continue;
if(arr[i][j]+j<n){
DP[i][j+arr[i][j]]+=DP[i][j];
}
if(arr[i][j]+i<n){
DP[i+arr[i][j]][j]+=DP[i][j];
}
}
}
cout << DP[n-1][n-1];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |