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 ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;
namespace
{
int N, k = 0, ono = 0;
vector<int> H;
void init()
{
while(k + 1 < N && H[k] < H[k + 1])
k++;
if(k == 0 || k == N - 1)
ono = 1;
}
}
void init(int _N, vector<int> _H) {
N = _N;
H = _H;
init();
}
int max_towers(int L, int R, int D) {
if(R <= k || k <= L || ono)
return 1;
else if(H[L] <= H[k] - D && H[R] <= H[k] - 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... |