# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
574165 | MilosMilutinovic | Stranded Far From Home (BOI22_island) | C++14 | 252 ms | 36804 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, s[N], fa[N], mx[N], ans[N];
long long sum[N];
vector<int> g[N], ch[N];
int getfa(int x) {
return fa[x] == x ? x : fa[x] = getfa(fa[x]);
}
void unite(int x, int y) {
x = getfa(x);
y = getfa(y);
if (x == y)
return;
if (sum[x] < mx[y])
ch[x].clear();
if (mx[x] > sum[y])
ch[y].clear();
if (ch[x].size() < ch[y].size())
swap(x, y);
for (int i : ch[y])
ch[x].push_back(i);
fa[y] = x;
mx[x] = max(mx[x], mx[y]);
sum[x] += sum[y];
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> m;
# | 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... |