# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
986686 | JooDdae | Salesman (IOI09_salesman) | C++17 | 1324 ms | 45472 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;
using ll = long long;
#define mid ((l+r) >> 1)
const int INF = 2e9, N = 5e5+1;
int n, u, d, s, mx[500500], t1[2002002], t2[2002002];
vector<array<int, 2>> v[500500];
void update(int t[], int id, int x, int node = 1, int l = 1, int r = N) {
if(id < l || r < id) return;
if(l == r) {
t[node] = max(t[node], x);
return;
}
update(t, id, x, node*2, l, mid), update(t, id, x, node*2+1, mid+1, r);
t[node] = max(t[node*2], t[node*2+1]);
}
int find(int t[], int nl, int nr, int node = 1, int l = 1, int r = N) {
if(nr < l || r < nl) return -INF;
if(nl <= l && r <= nr) return t[node];
int re = -INF;
if(nl <= mid) re = max(re, find(t, nl, nr, node*2, l, mid));
if(mid < nr) re = max(re, find(t, nl, nr, node*2+1, mid+1, r));
return re;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |