# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
877218 | hotboy2703 | Joker (BOI20_joker) | C++14 | 2004 ms | 14812 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;
#define pll pair <ll,ll>
#define fi first
#define se second
using ll = int;
ll n,m,q;
namespace DSU{
ll dsu[200100];
ll rev[200100];
void init(){
memset(dsu,-1,sizeof dsu);
memset(rev,-1,sizeof rev);
}
ll f(ll x){
if (dsu[x] < 0)return x;
return (dsu[x] = f(dsu[x]));
}
void m(ll x,ll y){
if (x == -1 || y == -1)return;
if (dsu[x] > dsu[y])swap(x,y);
dsu[x] += dsu[y];
dsu[y] = x;
}
bool join(ll x,ll y){
x = f(x),y = f(y);
if (x==y)return 0;
if (rev[x] == y)return 1;
else{
m(x,rev[y]);
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |