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;
const int maxl = 20;
const int maxn = 100010;
const int inf = 1000000010;
int n;
int peak;
int v[maxn];
void init(int N, vector<int> H) {
n = N;
for(int i = 1 ; i <= n ; i++)
v[i] = H[i];
for(int i = 1 ; i <= n ; i++)
if( v[i - 1] < v[i] && v[i] > v[i + 1] ) peak = i;
}
int max_towers(int L, int R, int D)
{
L++; R++;
if( peak <= L || R <= peak )
return 1;
if( v[L] <= v[peak] - D && v[R] <= v[peak] - D )
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... |