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>
#define pb push_back
using namespace std;
#include <vector>
const int N = 100100;
int cnt[N];
int h[N];
vector<int> pos;
#define pico ahiusuhashuis
vector<int> pico;
void init(int N, std::vector<int> H) {
for(int i=0;i<N;i++)h[i] = H[i];
for(int i=0;i<N;i++){
int l = (i == 0 || H[i] < H[i-1]);
int r = (i == N-1 || H[i] < H[i+1]);
if(l && r){
cnt[i]++;
}
if(i)cnt[i]+=cnt[i-1];
}
}
int max_towers(int L, int R, int D) {
if(L==R)return 1;
return max(1,cnt[R]-(L>0?cnt[L-1]:0));
}
# | 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... |