# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133482 | thebes | Werewolf (IOI18_werewolf) | C++14 | 1014 ms | 103148 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>
using namespace std;
const int MN = 4e5+5, LG = 20;
int ds[MN], p[MN], rep[MN], N, M, Q, i, j, vis[MN][2], nxt, sp[MN][LG], rev[MN], mp[MN], ans[MN];
struct edge{int x, y;}; vector<edge> ee;
vector<int> adj[MN];
int fnd(int x){return ds[x]=ds[x]==x?x:fnd(ds[x]);}
pair<int,int> a[MN]; set<int> st[MN];
struct qur{int s, r, id;}; vector<qur> q;
void dfs(int n){
vis[n][0]=++nxt; rev[nxt]=n; mp[n]=nxt;
sp[n][0]=p[n];
for(auto v : adj[n])
dfs(v);
vis[n][1]=nxt;
}
int anc(int n,int h){
for(int i=LG-1;i>=0;i--){
if(sp[n][i]>=h) n=sp[n][i];
}
return n;
}
vector<int> check_validity(int n,vector<int> x,vector<int> y,vector<int> s,vector<int> e,vector<int> l,vector<int> r){
N = n; M = x.size(); Q = s.size();
for(i=0;i<M;i++) ee.push_back({x[i]+1,y[i]+1});
for(i=0;i<Q;i++) s[i]++,e[i]++,l[i]++,r[i]++;
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... |