# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340307 | nikatamliani | Werewolf (IOI18_werewolf) | C++14 | 1977 ms | 179692 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 "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
const int NAX = 4e5+10, LG = 20;
vector<int> edges[NAX], tree[2][NAX], arr[2], ids;
int in[2][NAX], out[2][NAX], p[2][NAX], L[2][NAX][LG];
int timer;
void add_edge(int x, int y, int which) {
tree[which][x].push_back(y);
tree[which][y].push_back(x);
}
int find_set(int x, int which) {
return x == p[which][x] ? x : p[which][x] = find_set(p[which][x], which);
}
void union_sets(int x, int y, int which) {
x = find_set(x, which);
y = find_set(y, which);
if(x == y) {
return;
}
p[which][y] = x;
add_edge(x, y, which);
}
void dfs(int x, int p, int which) {
in[which][x] = ++timer;
L[which][x][0] = p;
arr[which].push_back(x);
for(int i = 1; i < LG; ++i) {
int up = L[which][x][i - 1];
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |