#include <bits/stdc++.h>
using namespace std;
int par[1001];
int Find(int x)
{
if(x == par[x])
{
return x;
}
return par[x] = Find(par[x]);
}
void Unite(int a, int b)
{
a = Find(a), b = Find(b);
if(a == b)
{
return;
}
par[a] = b;
}
void Solve()
{
int n, m, q;
cin >> n >> m >> q;
for(int i = 1; i <= n; i++)
{
par[i] = i;
}
for(int i = 1; i <= m; i++)
{
for(int j = 1; j <= n; j++)
{
int x;
cin >> x;
if(Find(x) != Find(j))
{
Unite(x, j);
}
}
}
for(int i = 1; i <= q; i++)
{
int a, b;
cin >> a >> b;
if(Find(a) != Find(b))
{
cout << "NE\n";
}
else
{
cout << "DA\n";
}
}
}
Compilation message
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status