Pagini recente » Cod sursa (job #590421) | Cod sursa (job #2414510) | Cod sursa (job #1071872) | Cod sursa (job #2093601) | Cod sursa (job #3203095)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("disjoint.in");
ofstream fout("disjoint.out");
int n,m;
int tata[100005];
int rad(int x)
{
while(tata[x]>0)
x=tata[x];
return x;
}
void unite(int x,int y)
{
}
int main()
{
cout<<"VAMAS"<<"\n";
cout<<"suveran samanumanunuisaman";
fin>>n>>m;
for(int i=1;i<=n;i++)
tata[i]=-1;
int c,x,y;
for(int i=1;i<=m;i++)
{
fin>>c>>x>>y;
if(c==1)
{
unite(x,y);
}
else
{
if(rad(x)==rad(y)) cout<<"DA"<<"\n";
cout<<"NU"<<"\n";
}
}
return 0;
}