# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074302 | Gromp15 | Radio Towers (IOI22_towers) | C++17 | 4074 ms | 4048 KiB |
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 <bits/stdc++.h>
#include "towers.h"
#define ll long long
#define ar array
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;
template<typename T> bool ckmin(T &a, const T &b ) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b ) { return a < b ? a = b, 1 : 0; }
int n; vector<int> h, h2, pref;
int D;
int test(int i) {
return (i && i+1 < n && ((h[i] > h[i-1] && h[i] > h[i+1])));
}
bool one_peak = 1;
int peak = -1;
void init(int N, std::vector<int> H) {
n = N;
h = H;
h2 = H;
sort(all(h2));
h2.erase(unique(all(h2)), h2.end());
for (int &x : h) x = lower_bound(all(h2), x) - h2.begin();
pref.resize(n);
for (int i = 0; i < n; i++) {
pref[i] = test(i) + (i ? pref[i-1] : 0);
}
peak = max_element(all(h)) - h.begin();
# | 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... |