제출 #1020293

#제출 시각아이디문제언어결과실행 시간메모리
1020293MohamedFaresNebili밀림 점프 (APIO21_jumps)C++14
0 / 100
265 ms65184 KiB
#include <bits/stdc++.h> using namespace std; int N; int L[2005][2005], R[2005][2005]; vector<int> H; void init(int _N, vector<int> _H) { N = _N; for(int l = 0; l < _N; l++) H.push_back(_H[l]); for(int l = 0; l < _N; l++) { R[l][l] = 0; int lst = _H[l]; for(int i = l + 1; i < _N; i++) { R[l][i] = R[l][i - 1] + (_H[i] > lst); lst = _H[i]; } L[l][l] = 0, lst = _H[l]; for(int i = l - 1; i >= 0; i--) { L[l][i] = L[l][i + 1] + (_H[i] > lst); lst = _H[i]; } } } int minimum_jumps(int A, int B, int C, int D) { int res = -1; for(int l = A; l <= B; l++) { for(int i = C; i <= D; i++) { for(int j = l; j >= 0; j--) { if(H[l] <= H[j] && H[j] <= H[i]) { res = (res == -1 ? L[l][j] + R[j][i] : max(res, L[l][j] + R[j][i])); } } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...