# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
212105 | kshitij_sodani | 조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2) | C++17 | 651 ms | 53508 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 <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl "\n"
ll par[100001];
ll size2[100001];
set<pair<ll,ll>> inc[100001];
set<pair<ll,ll>> out[100001];
ll find(ll no){
if(par[no]==no){
return no;
}
par[no]=find(par[no]);
return par[no];
}
set<ll> wait;
ll ans=0;
ll count(ll aa){
return (ll)size2[aa]*(size2[aa]-1)+(ll)inc[aa].size()*size2[aa];
}
void merge(ll aa,ll bb){
ans-=(count(aa)+count(bb));
if((inc[aa].size()+out[aa].size())<(inc[bb].size()+out[bb].size())){
swap(aa,bb);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |