# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
736854 | 2023-05-06T09:42:20 Z | VadimK | Kutije (COCI21_kutije) | C++17 | 157 ms | 13516 KB |
#include <bits/stdc++.h> using namespace std; vector <int> g[1005]; int vis[1005]; void dfs (int v, int cmp) { vis[v]=cmp; for (int i=0; i<g[v].size(); i++) if (!vis[g[v][i]]) dfs(g[v][i],cmp); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,m,q; cin>>n>>m>>q; for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) { int v; cin>>v; g[j].push_back(v); } int cmp=1; for (int i=1; i<=n; i++) { if (!vis[i]) dfs(i,cmp); cmp++; } while (q--) { int a,b; cin>>a>>b; if (vis[a]==vis[b]) cout<<"DA"; else cout<<"NE"; cout<<"\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 77 ms | 1876 KB | Output is correct |
2 | Correct | 68 ms | 1580 KB | Output is correct |
3 | Correct | 71 ms | 1560 KB | Output is correct |
4 | Correct | 80 ms | 1812 KB | Output is correct |
5 | Correct | 78 ms | 1828 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 77 ms | 1876 KB | Output is correct |
2 | Correct | 68 ms | 1580 KB | Output is correct |
3 | Correct | 71 ms | 1560 KB | Output is correct |
4 | Correct | 80 ms | 1812 KB | Output is correct |
5 | Correct | 78 ms | 1828 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 150 ms | 5888 KB | Output is correct |
27 | Correct | 144 ms | 13472 KB | Output is correct |
28 | Correct | 120 ms | 11576 KB | Output is correct |
29 | Correct | 157 ms | 13160 KB | Output is correct |
30 | Correct | 122 ms | 11672 KB | Output is correct |
31 | Correct | 121 ms | 11656 KB | Output is correct |
32 | Correct | 148 ms | 13516 KB | Output is correct |
33 | Correct | 148 ms | 13424 KB | Output is correct |
34 | Correct | 142 ms | 13412 KB | Output is correct |
35 | Correct | 150 ms | 13460 KB | Output is correct |