# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
652032 | Vladth11 | Stranded Far From Home (BOI22_island) | C++14 | 380 ms | 29772 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
using namespace std;
const int NMAX = 200001;
class DSU{
public:
int parent[NMAX], cnt[NMAX], suma[NMAX];
vector <int> comp[NMAX];
int root(int x){
if(x == parent[x])
return x;
return parent[x] = root(parent[x]);
}
void merge(int a, int b){
a = root(a);
b = root(b);
if(a == b)
return;
if(cnt[a] < cnt[b])
swap(a, b);
cnt[a] += cnt[b];
parent[b] = a;
suma[a] += suma[b];
for(auto x : comp[b])
comp[a].push_back(x);
comp[b].clear();
}
# | 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... |