# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124736 | dragonslayerit | Werewolf (IOI18_werewolf) | C++14 | 1295 ms | 82272 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 <map>
#include <iostream>
int find(std::vector<int>& uf,int a){
return (a==uf[a])?a:(uf[a]=find(uf,uf[a]));
}
struct HLD{
int N;
std::vector<std::vector<int> > adj;
std::vector<int> size,parent,head;
HLD(int N):N(N),adj(N),size(N),parent(N,-1),head(N){
}
void add_edge(int A,int B){
adj[A].push_back(B);
parent[B]=A;
}
void dfs_size(int node){
size[node]=1;
for(int child:adj[node]){
dfs_size(child);
size[node]+=size[child];
}
}
void dfs_hld(int node){
for(int& child:adj[node]){
if(size[child]>size[adj[node][0]]){
std::swap(child,adj[node][0]);
}
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... |