# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601883 | idiot123 | Werewolf (IOI18_werewolf) | C++14 | 963 ms | 134512 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;
int find(int a, vector<int>& rep){
if(rep[a] != a)rep[a] = find(rep[a], rep);
return rep[a];
}
void uni(int a, int b, vector<int>& rep, vector<set<int>>& pos){
a = find(a, rep); b = find(b, rep);
if(a != b){
if(pos[a].size() < pos[b].size())swap(a, b);
rep[b] = a;
pos[a].insert(pos[b].begin(), pos[b].end());
pos[b].clear();
}
}
void computeRange(int v, vector<pair<int, int>>& children, vector<pair<int, int>>& range, int& cnt){
if(children[v] == make_pair(-1, -1)){
range[v] = {cnt, cnt}; cnt++;
}else{
computeRange(children[v].first, children, range, cnt);
computeRange(children[v].second, children, range, cnt);
range[v] = {range[children[v].first].first, range[children[v].second].second};
}
}
# | 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... |