| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1200010 | 12345678 | Kutije (COCI21_kutije) | C++20 | 83 ms | 1864 KiB |
#include <bits/stdc++.h>
using namespace std;
const int nx=1e3+5;
int n, m, p[nx], dsu[nx], q, u, v, x;
int find(int x)
{
if (dsu[x]==x) return x;
return dsu[x]=find(dsu[x]);
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>m>>q;
for (int i=1; i<=n; i++) dsu[i]=i;
for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) cin>>x, dsu[find(x)]=find(j);
while (q--) cin>>u>>v, cout<<((find(u)==find(v))?"DA\n":"NE\n");
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
