답안 #1022182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1022182 2024-07-13T10:48:26 Z vjudge1 Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 9812 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1000 + 10;
int n, m, q, reachable[N][N];
vector<int> g[N];

void dfs(int v, int s){
    reachable[s][v] = 1;
    for (int u : g[v])
        if (!reachable[s][u])
            dfs(u, s);
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    cin >> n >> m >> q;
    for (int j = 0; j < m; j ++){
        for (int i = 1; i <= n; i ++){
            int x;
            cin >> x;
            g[i].push_back(x);
        }
    }

    for (int v = 1; v <= n; v ++)
        dfs(v, v);

    for (int i = 0; i < q; i ++){
        int u, v;
        cin >> u >> v;
        if (reachable[u][v])
            cout << "DA\n" << endl;
        else
            cout << "NE\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 448 ms 6360 KB Output is correct
2 Correct 391 ms 5712 KB Output is correct
3 Correct 164 ms 5340 KB Output is correct
4 Correct 555 ms 6404 KB Output is correct
5 Correct 54 ms 5712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 2 ms 2648 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 2 ms 2648 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 2 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 3 ms 2652 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2652 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 448 ms 6360 KB Output is correct
2 Correct 391 ms 5712 KB Output is correct
3 Correct 164 ms 5340 KB Output is correct
4 Correct 555 ms 6404 KB Output is correct
5 Correct 54 ms 5712 KB Output is correct
6 Correct 2 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 2 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 2 ms 2648 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 1 ms 2652 KB Output is correct
18 Correct 2 ms 2652 KB Output is correct
19 Correct 1 ms 2652 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 3 ms 2652 KB Output is correct
23 Correct 1 ms 2652 KB Output is correct
24 Correct 1 ms 2652 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
26 Correct 231 ms 9812 KB Output is correct
27 Correct 121 ms 9812 KB Output is correct
28 Execution timed out 1057 ms 8968 KB Time limit exceeded
29 Halted 0 ms 0 KB -