# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
650879 | NaimSS | Radio Towers (IOI22_towers) | C++17 | 447 ms | 2096 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 "towers.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#include <vector>
const int N = 100100;
int cnt[N];
int h[N];
vector<int> pos;
void init(int N, std::vector<int> H) {
cnt[0] = (N > 1 && H[0] < H[1]);
if(cnt[0])pos.pb(0);
for(int i=0;i<N;i++)h[i] = H[i];
for(int i=1;i<N;i++){
cnt[i]=cnt[i-1];
if(H[i] < H[i-1]){
cnt[i]++;
pos.pb(i);
}
}
}
int max_towers(int L, int R, int D) {
int v = (L+1<=R && h[L] < h[L+1]);
int p = upper_bound(pos.begin(),pos.end(),L) - pos.begin();
if(p == pos.size() || pos[p] > R)return 1;
int qtd = cnt[R] - cnt[pos[p]-1];
if(v)qtd++;
return qtd;
}
Compilation message (stderr)
# | 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... |