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 "towers.h"
#include <vector>
#include <algorithm>
using namespace std;
int n;
vector<int> H, prefixLocalMX;
void init(int N, vector<int> Hs) {
n = N, H = Hs;
prefixLocalMX.resize(1+n);
for (int i = 1; i < n-1; ++i) {
prefixLocalMX[i+1] += prefixLocalMX[i];
if (H[i] > H[i-1] && H[i] > H[i+1]) ++prefixLocalMX[i+1];
}
}
int max_towers(int L, int R, int D) { // case D = 1
return 1+max(0, prefixLocalMX[R] - prefixLocalMX[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... |