# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252432 | Saboon | New Home (APIO18_new_home) | C++14 | 5104 ms | 262984 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>
using namespace std;
typedef long long ll;
const int maxn = 3e5 + 20;
const int inf = 1e9;
set<pair<int,int>> tindex[maxn];
int ans[maxn];
vector<int> cmp;
multiset<int> seg[8*maxn];
pair<int,int> get(int id, int L, int R, int idx){
if (R <= idx or idx < L)
return {inf, 0};
if (L + 1 == R){
if (seg[id].empty())
return {inf,0};
return {*seg[id].begin(), *seg[id].rbegin()};
}
pair<int,int> ret = {inf,0};
if (!seg[id].empty())
ret = {*seg[id].begin(), *seg[id].rbegin()};
int mid = (L + R) >> 1;
auto it1 = get(2*id+0, L, mid, idx);
auto it2 = get(2*id+1, mid, R, idx);
ret.first = min({ret.first, it1.first, it2.first});
ret.second = max({ret.second, it1.second, it2.second});
return ret;
}
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... |