# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62443 | tmwilliamlin168 | New Home (APIO18_new_home) | C++14 | 3564 ms | 362312 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;
#define fi first
#define se second
const int mxN=3e5, mxC=1e8;
int n, k, q, x[mxN+2], ts[2*mxN+1], e2i, st[2*(2*mxN+1)], ans[mxN];
vector<array<int, 2>> es1[mxN];
array<int, 3> qs[mxN];
array<int, 4> es2[4*mxN];
struct scmp {
inline bool operator()(const int &a, const int &b) const {
return x[a]==x[b]?a<b:x[a]<x[b];
}
};
map<int, int, scmp> smp;
inline void solve() {
for(int i=0; i<k; ++i) {
smp[n+1]=0;
for(auto a : es1[i]) {
auto it1=smp.upper_bound(a[1]), it2=it1--;
es2[e2i++]={(x[it1->fi]+x[it2->fi]+1)/2, x[it2->fi], it2->se, a[0]};
it2->se=a[0];
if(it1->fi==a[1]) {
it2=it1--;
es2[e2i++]={(x[it1->fi]+x[a[1]]+1)/2, x[a[1]], it2->se, a[0]};
smp.erase(it2);
# | 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... |