답안 #862371

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
862371 2023-10-18T06:35:16 Z TAhmed33 Kutije (COCI21_kutije) C++
35 / 70
1000 ms 14620 KB
#include <bits/stdc++.h>
using namespace std;
vector <int> adj[1001];
bool vis[1001][1001];
void dfs (int pos, int k) {
	vis[pos][k] = 1;
	for (auto j : adj[pos]) {
		if (!vis[j][k]) {
			dfs(j, k);
		}
	}
}
int main () {
	int n, m, q;
	cin >> n >> m >> q;
	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			int x;
			cin >> x;
			adj[j].push_back(x);
		}
	}
	for (int i = 1; i <= n; i++) {
		dfs(i, i);
	}
	while (q--) {
		int a, b;
		cin >> a >> b;
		cout << (vis[a][b] ? "DA\n" : "NE\n");
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 716 ms 6580 KB Output is correct
2 Correct 641 ms 5956 KB Output is correct
3 Correct 660 ms 5716 KB Output is correct
4 Correct 724 ms 6740 KB Output is correct
5 Correct 718 ms 6956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 3 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 2 ms 600 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 484 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 2 ms 544 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 716 ms 6580 KB Output is correct
2 Correct 641 ms 5956 KB Output is correct
3 Correct 660 ms 5716 KB Output is correct
4 Correct 724 ms 6740 KB Output is correct
5 Correct 718 ms 6956 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 3 ms 604 KB Output is correct
8 Correct 3 ms 604 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 3 ms 604 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 600 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 2 ms 484 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 2 ms 544 KB Output is correct
24 Correct 2 ms 604 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 963 ms 14496 KB Output is correct
27 Correct 910 ms 14620 KB Output is correct
28 Execution timed out 1058 ms 9692 KB Time limit exceeded
29 Halted 0 ms 0 KB -