#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 main()
{
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
Main.cpp:25:1: error: '::main' must return 'int'
25 | void main()
| ^~~~