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;
#define eb emplace_back
#define mp make_pair
using ii = pair<int, int>;
int N, k;
vector<int> H;
void init(int N, vector<int> H) {
::N = N;
::H = H;
for (int i = 0; i < N; i++) {
if (i == N - 1 || H[i] > H[i + 1]) {
k = i;
break;
}
}
}
int max_towers(int L, int R, int D) {
if (!(L < k && k < R)) {
return 1;
}
if (H[k] - D >= max(H[L], H[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... |