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 N;
vector<int> H;
vector<int> S;
void init(int N, vector<int> H) {
::N = N;
::H = H;
S.resize(N);
for(int i = 1; i + 1 < N; i++) S[i] = S[i - 1] + (H[i - 1] < H[i] && H[i] > H[i + 1]);
}
int max_towers(int L, int R, int D) {
assert(D == 1);
if(L == R) return 1;
return S[R - 1] - S[L] + 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |