# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977828 | ZHIRDILBILDIZ | Street Lamps (APIO19_street_lamps) | C++14 | 719 ms | 170936 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>
#define fi first
#define se second
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
using namespace std;
const int N = 3e5 + 10;
int p[N];
int ans[N];
set<int> qr[N];
vector<int> gr[N];
void init(int _sz) {
for (int i = 1; i <= _sz; ++i)
p[i] = i,
gr[i].push_back(i);
}
void join (int u, int v, int w) {
u = p[u];
v = p[v];
if (u == v)
return;
if (gr[u].size() + qr[u].size() > gr[v].size() + qr[v].size())
swap(u, v);
for (int i : gr[u]) {
p[i] = v;
gr[v].push_back(i);
}
# | 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... |