# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
213311 | keko37 | Constellation 3 (JOI20_constellation3) | C++14 | 612 ms | 54008 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 llint;
typedef pair <int, int> pi;
const int MAXN = 200005;
llint n, m, ofs = 1, sum;
llint h[MAXN], x[MAXN], y[MAXN], cost[MAXN], val[MAXN];
llint mx[MAXN * 4], star[MAXN * 4], t[MAXN * 4], prop[MAXN * 4];
vector <int> v[MAXN];
inline int spoji_mx (int a, int b) {return h[a] >= h[b] ? a : b;}
inline int spoji_star (int a, int b) {return val[a] >= val[b] ? a : b;}
void tour_init () {
for (int i = 0; i < 2*ofs; i++) {
mx[i] = star[i] = n;
}
for (int i = 0; i < n; i++) {
mx[i + ofs] = star[i + ofs] = i;
if (v[i].empty()) val[i] = 0; else val[i] = y[v[i].back()];
}
for (int i = ofs-1; i > 0; i--) {
mx[i] = spoji_mx(mx[i * 2], mx[i * 2 + 1]);
star[i] = spoji_star(star[i * 2], star[i * 2 + 1]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |