Submission #58702

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
587022018-07-18 23:17:09leehosu01우호 조약 체결 (JOI14_friends)C++17
100 / 100
215 ms77504 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class UN{
public:
vector<int>P;
vector<list<int> >from;
UN(int n){P.resize(n);from.resize(n);for(int i=0;i<n;i++)P[i]=i,from[i].push_back(i);}
int F(int X){return X==P[X]?X:P[X]=F(P[X]);}
bool ch(int X,int Y)
{
if(from[F(X)].size()>from[F(Y)].size())swap(X,Y);
if(F(X)!=F(Y))
{
P[P[X]]=P[Y];
from[Y].insert(from[Y].end(),from[X].begin(),from[X].end());
from[X].clear();
return 1;
}
return 0;
}
};
vector<vector<int> >V;
vector<int>ST,NST,VC;
bitset<100000>IS,ch;
int N,M;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...