제출 #936010

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9360102024-02-29 23:08:43MinaRagy06Joker (BOI20_joker)C++17
6 / 100
182 ms262144 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 200'005;
int par[N], sz[N], dep[N];
int gud;
array<int, 2> find(int u) {
if (par[u] == u) {
return {u, 0};
}
array<int, 2> v = find(par[u]);
v[1] ^= dep[u];
return v;
}
vector<pair<int*, int>> logs;
void assign(int *x, int y) {
logs.push_back({x, *x});
*x = y;
}
void join(int u, int v) {
array<int, 2> pu = find(u), pv = find(v);
if (pu[0] == pv[0]) {
assign(&gud, gud && (dep[pv[0]] == (pv[1] ^ pu[1] ^ 1)));
return;
}
if (sz[pu[0]] < sz[pv[0]]) {
swap(u, v);
swap(pu, pv);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...