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;
using ll = long long;
ll k = -1;
void init(int N, std::vector<int> H) {
for(int i = 0; i + 1 < N; ++i) {
if(H[i] > H[i + 1]) {
k = i;
break;
}
}
if(k == -1) {
k = N - 1;
}
}
int max_towers(int L, int R, int D) {
if(k <= L or R <= k) {
return 0;
}
ll ans = (k - L) * (R - k);
assert(ans >= 0);
return ans;
}
# | 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... |