Submission #862371

# Submission time Handle Problem Language Result Execution time Memory
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");
	}
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 -