# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
790886 | esomer | Stranded Far From Home (BOI22_island) | C++17 | 165 ms | 24368 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;
typedef long long ll;
struct DSU{
vector<int> v;
vector<ll> sum;
vector<ll> ans;
vector<int> lst;
void init(vector<pair<int, int>>& a){
int n = (int)a.size();
v.assign(n, -1);
sum.assign(n, 0);
ans.resize(n);
lst.resize(n);
for(int i = 0; i < n; i++){
sum[a[i].second] = a[i].first;
ans[a[i].second] = a[i].first;
lst[a[i].second] = a[i].second;
}
}
int get(int x){return v[x] < 0 ? x : v[x] = get(v[x]);}
void unite(int x, int y, pair<int, int> val){
x = get(x); y = get(y);
if(x == y) return;
if(v[x] > v[y]) swap(x, 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... |