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 <bits/stdc++.h>
using namespace std;
int n, pre[200100], cnt[200100];
void init(int N, vector<int> H) {
for(int i = 1; i < N-1; i++)
pre[i]=pre[i-1]+(H[i]>max(H[i-1],H[i+1]));
pre[n-1] = pre[n-2];
}
int max_towers(int L, int R, int D) {
if(R-L<2)
return 1;
return pre[R-1]-pre[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... |