# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831862 | welleyth | Fountain Parks (IOI21_parks) | C++17 | 472 ms | 57756 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 "parks.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int N = (int)3e5+11;
int p[N];
mt19937 rnd(time(nullptr));
int components;
int get(int x){
return p[x] == x ? x : p[x] = get(p[x]);
}
void union_sets(int a,int b){
a = get(a), b = get(b);
if(a == b) return;
if(rnd()&1) swap(a,b);
p[a] = b;
components--;
return;
}
int construct_roads(std::vector<int> _x, std::vector<int> _y) {
int n = _x.size();
components = n;
for(int i = 0; i < n; i++) p[i] = i;
vector<pair<int,int>> fountains;
map<pair<int,int>,int> id;
# | 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... |