# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
507612 |
2022-01-12T20:06:55 Z |
t0nhou |
Kutije (COCI21_kutije) |
C++17 |
|
1000 ms |
48948 KB |
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
set<int> viz[1005];
int vis[1005];
void dfs(int x){
vis[x] = 1;
for(auto v : viz[x])
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].insert(a);
viz[a].insert(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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
453 ms |
38988 KB |
Output is correct |
2 |
Correct |
373 ms |
33556 KB |
Output is correct |
3 |
Correct |
228 ms |
12888 KB |
Output is correct |
4 |
Correct |
546 ms |
48948 KB |
Output is correct |
5 |
Correct |
90 ms |
1916 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
16 ms |
1092 KB |
Output is correct |
4 |
Correct |
5 ms |
844 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
15 ms |
1228 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
460 KB |
Output is correct |
10 |
Correct |
1 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
16 ms |
1092 KB |
Output is correct |
4 |
Correct |
5 ms |
844 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
15 ms |
1228 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
460 KB |
Output is correct |
10 |
Correct |
1 ms |
464 KB |
Output is correct |
11 |
Correct |
2 ms |
460 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
14 ms |
1192 KB |
Output is correct |
14 |
Correct |
4 ms |
716 KB |
Output is correct |
15 |
Correct |
2 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
460 KB |
Output is correct |
17 |
Correct |
14 ms |
1320 KB |
Output is correct |
18 |
Correct |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
460 KB |
Output is correct |
20 |
Correct |
1 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
453 ms |
38988 KB |
Output is correct |
2 |
Correct |
373 ms |
33556 KB |
Output is correct |
3 |
Correct |
228 ms |
12888 KB |
Output is correct |
4 |
Correct |
546 ms |
48948 KB |
Output is correct |
5 |
Correct |
90 ms |
1916 KB |
Output is correct |
6 |
Correct |
2 ms |
460 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
16 ms |
1092 KB |
Output is correct |
9 |
Correct |
5 ms |
844 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
460 KB |
Output is correct |
12 |
Correct |
15 ms |
1228 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
460 KB |
Output is correct |
15 |
Correct |
1 ms |
464 KB |
Output is correct |
16 |
Correct |
2 ms |
460 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
14 ms |
1192 KB |
Output is correct |
19 |
Correct |
4 ms |
716 KB |
Output is correct |
20 |
Correct |
2 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
460 KB |
Output is correct |
22 |
Correct |
14 ms |
1320 KB |
Output is correct |
23 |
Correct |
2 ms |
384 KB |
Output is correct |
24 |
Correct |
1 ms |
460 KB |
Output is correct |
25 |
Correct |
1 ms |
460 KB |
Output is correct |
26 |
Correct |
662 ms |
11308 KB |
Output is correct |
27 |
Correct |
242 ms |
2788 KB |
Output is correct |
28 |
Execution timed out |
1092 ms |
34132 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |