# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
787380 | ymm | Measures (CEOI22_measures) | C++17 | 0 ms | 0 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>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
typedef long long ll;
typedef std::pair<ll,ll> pll;
using namespace std;
const int N = 200'020;
ll a[N], b[N], D;
int n, m;
vector<pll> cmper;
namespace seg {
struct {
ll mn, mx, cst;
} t[N*4];
int sz;
void merge(int i) {
if (t[2*i+1].cst == -1) {
t[i] = t[2*i+2];
return;
}
if (t[2*i+2].cst == -1) {
t[i] = t[2*i+1];
return;
}
auto l = t[2*i+1];
auto r = t[2*i+2];
if (l.cst < r.cst) {
ll x = r.mn - D - l.mx;