# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1163072 | WH8 | Stranded Far From Home (BOI22_island) | C++20 | 227 ms | 43376 KiB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define int long long
#define f first
#define s second
#define pll pair<long long, long long>
int v[200005], p[200005], gv[200005];
vector<vector<int>> pi(200005);
vector<vector<int>> al(200005);
int par(int x){
if(p[x]==-1)return x;
return p[x]=par(p[x]);
}
void merge(int a, int b){ // b is the new node that we are inserting
//~ printf("merging %lld, %lld\n", a,b);
int x=par(a), y=par(b);
if(x==y)return;
//~ cout<<"here\n";
if(gv[x] < v[b]){
pi[x].clear();
p[x]=y;
gv[y]+=gv[x];
}
# | 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... |