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;
//subtask 1
const int nax = 100005;
int n;
int tp;
void init(int N, vector<int> H) {
n = N;
if(n==1) return;
if(H[0]>H[1]) tp = -1;
if(H[n-2]<H[n-1]) tp = -1;
for(int i=1; i<n-1; ++i) {
if(H[i]>max(H[i-1], H[i+1])) {
tp = i;
return;
}
}
}
int max_towers(int L, int R, int D) {
if(n==1 || tp==-1 || R-L+1<3) return 1;
if(tp>L && tp<R) 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... |