# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
858713 | NeroZein | Making Friends on Joitter is Fun (JOI20_joitter2) | C++17 | 601 ms | 60984 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;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
const int N = 1e5 + 5;
long long ans;
set<int> r[N];
int p[N], sz[N];
set<pair<int, int>> in[N], out[N];
int get(int x) {
return p[x] = (p[x] == x ? x : get(p[x]));
}
void merge(int x, int y) {
x = get(x), y = get(y);
if (x == y) {
return;
}
auto f = in[x].lower_bound(make_pair(y, 0));
while (f != in[x].end() && f->first == y) {
ans -= sz[x];
r[x].erase(f->second);
out[y].erase(make_pair(x, f->second));
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |