# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
547749 | NachoLibre | Regions (IOI09_regions) | C++17 | 4354 ms | 86800 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 ll long long
#define ld long double
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
const int N = 200005, C = 500, R = 25004, Q = N;
int n, r, q, h[N], s[N], c[R], r1, r2, gd, e[N], o[N];
vector<int> v[N], ve[R];
vector<array<int, 2> > veo[R];
map<array<int, 2>, int> zd, qd;
int dfs(int x = 1, int zdc = 0) {
if(h[x] == gd) zdc += 1;
int qdc = (h[x] == gd);
for(int y : v[x]) {
qdc += dfs(y, zdc);
}
if(h[x] != gd) {
zd[{gd, h[x]}] += zdc;
qd[{h[x], gd}] += qdc;
}
return qdc;
}
int dfsi(int x = 1) {
int z = e[x] + 1;
for(int y : v[x]) {
e[y] = z;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |