# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
554467 | keta_tsimakuridze | Werewolf (IOI18_werewolf) | C++14 | 3760 ms | 428156 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>
#include "werewolf.h"
using namespace std;
#define pii pair<int,int>
#define f first
#define s second
const int N = 5e5 + 5, inf = 1e9;
vector<int> V[2][N];
int cur[2], x[2][N], p[2][N][20], timer[2], tmin[2][N], tmout[2][N], pos[2][N], n;
int par[2][N];
vector<pii> edges;
set<int> s[4 * N];
int find(int u,int t) {
return (par[t][u] == u ? u : par[t][u] = find(par[t][u], t));
}
void build(vector<pair<int,int> > edges, int t) {
cur[t] = n;
for(int i = 1; i <= cur[t]; i++) par[t][i] = i;
for(int i = 0; i < edges.size(); i++) {
int u = edges[i].f, v = edges[i].s;
if(find(u, t) != find(v, t)) {
++cur[t]; par[t][cur[t]] = cur[t];
V[t][cur[t]].push_back(find(u, t));
V[t][cur[t]].push_back(find(v, t));
x[t][cur[t]] = u;
u = find(u, t), v = find(v, t);
par[t][u] = cur[t];
par[t][v] = cur[t];
p[t][u][0] = p[t][v][0] = cur[t];
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... |