# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631078 | abeker | Radio Towers (IOI22_towers) | C++17 | 2583 ms | 69480 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"
using namespace std;
const int INF = INT_MAX;
class Orthogonal {
int offset;
vector <vector <int>> tour;
public:
Orthogonal(vector <int> vals) {
for (offset = 1; offset < vals.size(); offset *= 2);
tour.resize(2 * offset);
for (int i = 1; i < vals.size(); i++)
tour[i + offset].push_back(vals[i]);
for (int i = offset - 1; i; i--) {
tour[i].resize(tour[2 * i].size() + tour[2 * i + 1].size());
merge(tour[2 * i].begin(), tour[2 * i].end(), tour[2 * i + 1].begin(), tour[2 * i + 1].end(), tour[i].begin());
}
}
Orthogonal() {}
int query(int x, int lo, int hi, int from, int to, int val) {
if (lo >= to || hi <= from)
return 0;
if (lo >= from && hi <= to)
return lower_bound(tour[x].begin(), tour[x].end(), val) - tour[x].begin();
int mid = (lo + hi) / 2;
return query(2 * x, lo, mid, from, to, val) + query(2 * x + 1, mid, hi, from, to, val);
}
int query(int from, int to, int val) {
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... |