# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
216729 | ainta | Constellation 3 (JOI20_constellation3) | C++17 | 282 ms | 58360 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<cstdio>
#include<algorithm>
#include<vector>
#define N_ 401000
#define SZ 262144
#define pii pair<int,int>
using namespace std;
int n, H[N_], m, IT[SZ + SZ], cnt;
vector<pii>G[N_];
void Put(int a, int b) {
a += SZ;
IT[a] = b;
while (a != 1) {
a >>= 1;
IT[a] = max(IT[a * 2], IT[a * 2 + 1]);
}
}
pii GetMax(int b, int e) {
b += SZ, e += SZ;
int pv = -1, Mx = -1;
while (b <= e) {
if (Mx < IT[b])Mx = IT[b], pv = b;
if (Mx < IT[e])Mx = IT[e], pv = e;
b = (b + 1) >> 1, e = (e - 1) >> 1;
}
while (pv < SZ) {
pv *= 2;
if (IT[pv] != Mx)pv++;
}
return { Mx,pv - SZ };
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... |