# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120121 | Meloric | Werewolf (IOI18_werewolf) | C++14 | 2167 ms | 161096 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>
#define pb push_back
#define pii pair<int, int>
#define X first
#define Y second
#define ub upper_bound
#define lb lower_bound
using namespace std;
/*
- Make Reachability Tree by sorting indexes and DSU
- Subtree of Vertex includes all Vertices reachable from that vertex
- Connect new vertex to parent of new connections
- Then use binary lifting to find highest vertex in subtree with val <= to query
- Finally use euler tour pre/ post vals to find rectangle needed to be queried
- Offline + Fenwick Tree to check if there is a vertex/point in rectangle
*/
struct disj{
vector<int> par;
disj(int n){
for(int i = 0; i<n; i++)par.pb(i);
}
int fi(int a){return (a == par[a]) ? a : par[a] = fi(par[a]);}
void me(int a, int b){
a = fi(a);
b = fi(b);
par[b] = a;
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... |