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;
namespace {
vector<int> H;
int mid;
}
void init(int N,vector<int> H){
H.emplace(H.begin(),0);
H.emplace(H.end(),0);
::H = H;
for(int i=1;i<=N;i++)if(H[i]>H[i-1] and H[i]>H[i+1])mid=i;
}
int max_towers(int L,int R,int D){
L++;R++;
if(R<mid or mid<L)return 1;
if(max(H[L],H[R])+D<=H[mid])return 2;
return 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... |