# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
765269 | canadavid1 | Joker (BOI20_joker) | C++14 | 205 ms | 10132 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<bool> diff;
vector<int> p;
vector<int> siz;
pair<int,bool> find(int a,bool len=0)
{
if (p[a] == -1) return {a,len};
return find(p[a],len^diff[a]); // no path compression
}
bool unite(int a,int b) // true if works, false elsewise
{
auto av = find(a);
auto bv = find(b);
if (av.first == bv.first) return av.second!=bv.second;
if (siz[av.first] > siz[bv.first]) swap(av,bv);
// b > a
p[av.first] = bv.first;
siz[bv.first] += siz[av.first];
if (av.second == bv.second) diff[av.first] = true;
return true;
}
# | 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... |