# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
734279 | mosiashvililuka | Making Friends on Joitter is Fun (JOI20_joitter2) | C++14 | 786 ms | 71336 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;
int a,b,c,d,e,i,j,ii,jj,zx,xc,t,tes,msh[100009],C,D;
long long pas;
vector <int> V[100009];
set <int> in[100009],out[100009],sm[100009];//sm-c ideashi in-ebia ogond komponentis magivrad wveros nomers agdeb
set <int>::iterator it,tt;
bool check(int q, int w){
if(out[w].find(q)==out[w].end()) return 0; else return 1;
}
void mrg(int Q, int W){
int q=msh[Q],w=msh[W];
if(q==w) return;
if(V[q].size()+in[q].size()+out[q].size()+sm[q].size()<V[w].size()+in[w].size()+out[w].size()+sm[w].size()) swap(q,w);
long long qw=V[q].size(),we=V[w].size(),Sq=sm[q].size(),Sw=sm[w].size();
pas-=qw*(qw-1);
pas-=we*(we-1);
pas-=qw*Sq;
pas-=we*Sw;
//
vector <pair <int, int> > NXT;
for(vector <int>::iterator IT=V[w].begin(); IT!=V[w].end(); IT++){
V[q].push_back((*IT));
tt=sm[q].find((*IT));
if(tt!=sm[q].end()){
sm[q].erase(tt);
}
msh[(*IT)]=q;
}
V[w].clear();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |