# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
507606 | 2022-01-12T20:01:02 Z | t0nhou | Kutije (COCI21_kutije) | C++17 | 1000 ms | 52548 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); } } 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 475 ms | 41924 KB | Output is correct |
2 | Correct | 370 ms | 36840 KB | Output is correct |
3 | Correct | 197 ms | 15724 KB | Output is correct |
4 | Correct | 504 ms | 52548 KB | Output is correct |
5 | Correct | 96 ms | 5572 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 516 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 3 ms | 780 KB | Output is correct |
4 | Correct | 2 ms | 576 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 1 ms | 428 KB | Output is correct |
7 | Correct | 4 ms | 844 KB | Output is correct |
8 | Correct | 1 ms | 428 KB | Output is correct |
9 | Correct | 1 ms | 588 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 516 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 3 ms | 780 KB | Output is correct |
4 | Correct | 2 ms | 576 KB | Output is correct |
5 | Correct | 2 ms | 460 KB | Output is correct |
6 | Correct | 1 ms | 428 KB | Output is correct |
7 | Correct | 4 ms | 844 KB | Output is correct |
8 | Correct | 1 ms | 428 KB | Output is correct |
9 | Correct | 1 ms | 588 KB | Output is correct |
10 | Correct | 1 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 1 ms | 428 KB | Output is correct |
13 | Correct | 3 ms | 844 KB | Output is correct |
14 | Correct | 2 ms | 528 KB | Output is correct |
15 | Correct | 1 ms | 460 KB | Output is correct |
16 | Correct | 1 ms | 460 KB | Output is correct |
17 | Correct | 4 ms | 844 KB | Output is correct |
18 | Correct | 2 ms | 460 KB | Output is correct |
19 | Correct | 2 ms | 460 KB | Output is correct |
20 | Correct | 1 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 475 ms | 41924 KB | Output is correct |
2 | Correct | 370 ms | 36840 KB | Output is correct |
3 | Correct | 197 ms | 15724 KB | Output is correct |
4 | Correct | 504 ms | 52548 KB | Output is correct |
5 | Correct | 96 ms | 5572 KB | Output is correct |
6 | Correct | 1 ms | 516 KB | Output is correct |
7 | Correct | 1 ms | 460 KB | Output is correct |
8 | Correct | 3 ms | 780 KB | Output is correct |
9 | Correct | 2 ms | 576 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 1 ms | 428 KB | Output is correct |
12 | Correct | 4 ms | 844 KB | Output is correct |
13 | Correct | 1 ms | 428 KB | Output is correct |
14 | Correct | 1 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 | 1 ms | 428 KB | Output is correct |
18 | Correct | 3 ms | 844 KB | Output is correct |
19 | Correct | 2 ms | 528 KB | Output is correct |
20 | Correct | 1 ms | 460 KB | Output is correct |
21 | Correct | 1 ms | 460 KB | Output is correct |
22 | Correct | 4 ms | 844 KB | Output is correct |
23 | Correct | 2 ms | 460 KB | Output is correct |
24 | Correct | 2 ms | 460 KB | Output is correct |
25 | Correct | 1 ms | 460 KB | Output is correct |
26 | Correct | 350 ms | 17904 KB | Output is correct |
27 | Correct | 179 ms | 13728 KB | Output is correct |
28 | Execution timed out | 1012 ms | 47376 KB | Time limit exceeded |
29 | Halted | 0 ms | 0 KB | - |