# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872519 | overwatch9 | Regions (IOI09_regions) | C++17 | 3982 ms | 66764 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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 2e5 + 10;
const int maxr = 25000 + 10;
vector <int> adj[maxn];
int region[maxn];
vector <int> region_members[maxr];
int visit[maxn], finish[maxn];
int n, r, q, t = 0;
void dfs(int s) {
visit[s] = t++;
for (auto i : adj[s])
dfs(i);
finish[s] = t++;
}
vector <vector <int>> r1r2, cnt;
int big_region_cnt = 0;
int big_id[maxn];
void dfs2(int s, int p) {
int id1 = big_id[region[s]];
int id2 = big_id[region[p]];
cnt[s] = cnt[p];
if (id2 != -1 && s != p)
cnt[s][id2]++;
if (id1 != -1) {
for (int i = 0; i < big_region_cnt; i++)
r1r2[i][id1] += cnt[s][i];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |