# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226191 | Minnakhmetov | Making Friends on Joitter is Fun (JOI20_joitter2) | C++14 | 5 ms | 512 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;
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()
const int N = 1e5 + 5;
int w[N];
set<int> *members[N], *ingoing_ver[N], *outgoing_gr[N], *ingoing_gr[N];
ll ans = 0;
int n, m;
int find_set(int x) {
return w[x] < 0 ? x : w[x] = find_set(w[x]);
}
void mrg(int x, int y) {
x = find_set(x);
y = find_set(y);
if (x == y)
return;
ans -= members[x]->size() * (ll)(members[x]->size() - 1);
ans -= members[y]->size() * (ll)(members[y]->size() - 1);
ans -= ingoing_ver[x]->size() * (ll)members[x]->size();
ans -= ingoing_ver[y]->size() * (ll)members[y]->size();
if (members[x]->size() + ingoing_ver[x]->size() <
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |