# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
507608 | 2022-01-12T20:02:30 Z | t0nhou | Kutije (COCI21_kutije) | C++17 | 1000 ms | 48796 KB |
#include <bits/stdc++.h> #define endl '\n' using namespace std; vector<int> viz[1005]; int vis[1005]; void dfs(int x){ vis[x] = 1; for(int i = 0; i < viz[x].size(); i++){ int v = viz[x][i]; if(!vis[v]) dfs(v); } } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n, m, q; cin >> n >> m >> q; for(int i = 0; i < m; i++){ for(int j = 1; j <= n; j++){ int a; cin >> a; viz[j].push_back(a); viz[a].push_back(j); } } set<int> s[1005]; for(int i = 1; i <= n; i++){ dfs(i); for(int j = 1; j <= n; j++){ if(vis[j]) s[i].insert(j); vis[j] = 0; } } while(q--){ int a, b; cin >> a >> b; if(s[a].find(b) != s[a].end()) cout << "DA" << endl; else cout << "NE" << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 447 ms | 38892 KB | Output is correct |
2 | Correct | 357 ms | 33528 KB | Output is correct |
3 | Correct | 220 ms | 12700 KB | Output is correct |
4 | Correct | 527 ms | 48796 KB | Output is correct |
5 | Correct | 97 ms | 1964 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 460 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 3 ms | 844 KB | Output is correct |
4 | Correct | 3 ms | 716 KB | Output is correct |
5 | Correct | 1 ms | 460 KB | Output is correct |
6 | Correct | 2 ms | 460 KB | Output is correct |
7 | Correct | 4 ms | 968 KB | Output is correct |
8 | Correct | 1 ms | 460 KB | Output is correct |
9 | Correct | 2 ms | 588 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 460 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 3 ms | 844 KB | Output is correct |
4 | Correct | 3 ms | 716 KB | Output is correct |
5 | Correct | 1 ms | 460 KB | Output is correct |
6 | Correct | 2 ms | 460 KB | Output is correct |
7 | Correct | 4 ms | 968 KB | Output is correct |
8 | Correct | 1 ms | 460 KB | Output is correct |
9 | Correct | 2 ms | 588 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 460 KB | Output is correct |
12 | Correct | 1 ms | 460 KB | Output is correct |
13 | Correct | 4 ms | 892 KB | Output is correct |
14 | Correct | 2 ms | 588 KB | Output is correct |
15 | Correct | 1 ms | 460 KB | Output is correct |
16 | Correct | 2 ms | 460 KB | Output is correct |
17 | Correct | 4 ms | 972 KB | Output is correct |
18 | Correct | 1 ms | 460 KB | Output is correct |
19 | Correct | 2 ms | 588 KB | Output is correct |
20 | Correct | 1 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 447 ms | 38892 KB | Output is correct |
2 | Correct | 357 ms | 33528 KB | Output is correct |
3 | Correct | 220 ms | 12700 KB | Output is correct |
4 | Correct | 527 ms | 48796 KB | Output is correct |
5 | Correct | 97 ms | 1964 KB | Output is correct |
6 | Correct | 1 ms | 460 KB | Output is correct |
7 | Correct | 1 ms | 460 KB | Output is correct |
8 | Correct | 3 ms | 844 KB | Output is correct |
9 | Correct | 3 ms | 716 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 4 ms | 968 KB | Output is correct |
13 | Correct | 1 ms | 460 KB | Output is correct |
14 | Correct | 2 ms | 588 KB | Output is correct |
15 | Correct | 1 ms | 460 KB | Output is correct |
16 | Correct | 1 ms | 460 KB | Output is correct |
17 | Correct | 1 ms | 460 KB | Output is correct |
18 | Correct | 4 ms | 892 KB | Output is correct |
19 | Correct | 2 ms | 588 KB | Output is correct |
20 | Correct | 1 ms | 460 KB | Output is correct |
21 | Correct | 2 ms | 460 KB | Output is correct |
22 | Correct | 4 ms | 972 KB | Output is correct |
23 | Correct | 1 ms | 460 KB | Output is correct |
24 | Correct | 2 ms | 588 KB | Output is correct |
25 | Correct | 1 ms | 512 KB | Output is correct |
26 | Correct | 446 ms | 14696 KB | Output is correct |
27 | Correct | 216 ms | 10604 KB | Output is correct |
28 | Execution timed out | 1083 ms | 30420 KB | Time limit exceeded |
29 | Halted | 0 ms | 0 KB | - |