Submission #862373

# Submission time Handle Problem Language Result Execution time Memory
862373 2023-10-18T06:38:27 Z TAhmed33 Kutije (COCI21_kutije) C++
70 / 70
831 ms 10500 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
bool adj[1001][1001];
int main () {
	ios::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 x; cin >> x;
			adj[j][x] = 1;
		}
	}
	for (int i = 1; i <= n; i++) adj[i][i] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				adj[j][k] |= (adj[j][i] & adj[i][k]);
			}
		}
	}
	while (q--) {
		int a, b;
		cin >> a >> b;
		cout << (adj[a][b] ? "DA\n" : "NE\n");
	}
}
# Verdict Execution time Memory Grader output
1 Correct 765 ms 2896 KB Output is correct
2 Correct 622 ms 2632 KB Output is correct
3 Correct 570 ms 2364 KB Output is correct
4 Correct 764 ms 2692 KB Output is correct
5 Correct 769 ms 2696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 1 ms 552 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 564 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 765 ms 2896 KB Output is correct
2 Correct 622 ms 2632 KB Output is correct
3 Correct 570 ms 2364 KB Output is correct
4 Correct 764 ms 2692 KB Output is correct
5 Correct 769 ms 2696 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 568 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 1 ms 552 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 2 ms 564 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 831 ms 2712 KB Output is correct
27 Correct 827 ms 2704 KB Output is correct
28 Correct 625 ms 2512 KB Output is correct
29 Correct 795 ms 2692 KB Output is correct
30 Correct 609 ms 2348 KB Output is correct
31 Correct 632 ms 2384 KB Output is correct
32 Correct 808 ms 6736 KB Output is correct
33 Correct 811 ms 10324 KB Output is correct
34 Correct 817 ms 10500 KB Output is correct
35 Correct 815 ms 10496 KB Output is correct