# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
724513 | 2023-04-15T12:46:03 Z | TheSahib | Kutije (COCI21_kutije) | C++14 | 1000 ms | 17292 KB |
#include <bits/stdc++.h> #pragma GCC optimize("O3") #define ll long long #define oo 1e9 + 9 #define pii pair<ll, ll> using namespace std; const int MAX = 1005; int n, m, q; int g[MAX][MAX]; int dist[MAX][MAX]; bool visited[MAX]; void dfs(int node, int p){ visited[node] = 1; dist[p][node] = 1; for (int i = 1; i <= n; i++) { if(g[node][i] && !visited[i]){ dfs(i, p); } } } int main(){ cin >> n >> m >> q; for (int i = 0; i < m; i++) { for (int j = 1; j <= n; j++) { int a; scanf("%d", &a); g[j][a] = 1; } } for (int i = 1; i <= n; i++) { memset(visited, 0, sizeof(visited)); dfs(i, i); } while(q--){ int a, b; scanf("%d %d", &a, &b); if(dist[a][b]){ cout << "DA\n"; } else{ cout << "NE\n"; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 675 ms | 12860 KB | Output is correct |
2 | Correct | 557 ms | 11596 KB | Output is correct |
3 | Correct | 279 ms | 11344 KB | Output is correct |
4 | Correct | 832 ms | 12844 KB | Output is correct |
5 | Correct | 126 ms | 12856 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1092 KB | Output is correct |
2 | Correct | 2 ms | 1108 KB | Output is correct |
3 | Correct | 4 ms | 964 KB | Output is correct |
4 | Correct | 3 ms | 1108 KB | Output is correct |
5 | Correct | 2 ms | 1112 KB | Output is correct |
6 | Correct | 1 ms | 1096 KB | Output is correct |
7 | Correct | 2 ms | 1108 KB | Output is correct |
8 | Correct | 1 ms | 1108 KB | Output is correct |
9 | Correct | 2 ms | 1108 KB | Output is correct |
10 | Correct | 2 ms | 1108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1092 KB | Output is correct |
2 | Correct | 2 ms | 1108 KB | Output is correct |
3 | Correct | 4 ms | 964 KB | Output is correct |
4 | Correct | 3 ms | 1108 KB | Output is correct |
5 | Correct | 2 ms | 1112 KB | Output is correct |
6 | Correct | 1 ms | 1096 KB | Output is correct |
7 | Correct | 2 ms | 1108 KB | Output is correct |
8 | Correct | 1 ms | 1108 KB | Output is correct |
9 | Correct | 2 ms | 1108 KB | Output is correct |
10 | Correct | 2 ms | 1108 KB | Output is correct |
11 | Correct | 2 ms | 1088 KB | Output is correct |
12 | Correct | 1 ms | 1108 KB | Output is correct |
13 | Correct | 4 ms | 980 KB | Output is correct |
14 | Correct | 3 ms | 980 KB | Output is correct |
15 | Correct | 2 ms | 1088 KB | Output is correct |
16 | Correct | 2 ms | 980 KB | Output is correct |
17 | Correct | 2 ms | 1092 KB | Output is correct |
18 | Correct | 2 ms | 1108 KB | Output is correct |
19 | Correct | 2 ms | 1092 KB | Output is correct |
20 | Correct | 2 ms | 1108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 675 ms | 12860 KB | Output is correct |
2 | Correct | 557 ms | 11596 KB | Output is correct |
3 | Correct | 279 ms | 11344 KB | Output is correct |
4 | Correct | 832 ms | 12844 KB | Output is correct |
5 | Correct | 126 ms | 12856 KB | Output is correct |
6 | Correct | 2 ms | 1092 KB | Output is correct |
7 | Correct | 2 ms | 1108 KB | Output is correct |
8 | Correct | 4 ms | 964 KB | Output is correct |
9 | Correct | 3 ms | 1108 KB | Output is correct |
10 | Correct | 2 ms | 1112 KB | Output is correct |
11 | Correct | 1 ms | 1096 KB | Output is correct |
12 | Correct | 2 ms | 1108 KB | Output is correct |
13 | Correct | 1 ms | 1108 KB | Output is correct |
14 | Correct | 2 ms | 1108 KB | Output is correct |
15 | Correct | 2 ms | 1108 KB | Output is correct |
16 | Correct | 2 ms | 1088 KB | Output is correct |
17 | Correct | 1 ms | 1108 KB | Output is correct |
18 | Correct | 4 ms | 980 KB | Output is correct |
19 | Correct | 3 ms | 980 KB | Output is correct |
20 | Correct | 2 ms | 1088 KB | Output is correct |
21 | Correct | 2 ms | 980 KB | Output is correct |
22 | Correct | 2 ms | 1092 KB | Output is correct |
23 | Correct | 2 ms | 1108 KB | Output is correct |
24 | Correct | 2 ms | 1092 KB | Output is correct |
25 | Correct | 2 ms | 1108 KB | Output is correct |
26 | Correct | 401 ms | 17292 KB | Output is correct |
27 | Correct | 196 ms | 17284 KB | Output is correct |
28 | Execution timed out | 1081 ms | 8352 KB | Time limit exceeded |
29 | Halted | 0 ms | 0 KB | - |