답안 #876545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
876545 2023-11-21T23:10:43 Z Youssif_Elkadi Kutije (COCI21_kutije) C++17
70 / 70
893 ms 14200 KB
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 5, mod = 998244353;
vector<int> adj[N];
bool vis[N][N];
void dfs(int u, int src)
{
    vis[src][u] = 1;
    for (auto v : adj[u])
        if (!vis[src][v])
            dfs(v, src);
}
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
    int n, m, q;
    cin >> n >> m >> q;
    for (int i = 0; i < m; i++)
    {
        for (int i = 1; i <= n; i++)
        {
            int x;
            cin >> x;
            adj[i].push_back(x);
        }
    }
    for (int i = 1; i <= n; i++)
        dfs(i, i);
    while (q--)
    {
        int u, v;
        cin >> u >> v;
        if (vis[u][v])
            cout << "DA\n";
        else
            cout << "NE\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 6440 KB Output is correct
2 Correct 57 ms 5796 KB Output is correct
3 Correct 52 ms 5596 KB Output is correct
4 Correct 67 ms 6484 KB Output is correct
5 Correct 58 ms 6484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 500 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 6440 KB Output is correct
2 Correct 57 ms 5796 KB Output is correct
3 Correct 52 ms 5596 KB Output is correct
4 Correct 67 ms 6484 KB Output is correct
5 Correct 58 ms 6484 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 2 ms 600 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 2 ms 604 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 500 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 1 ms 604 KB Output is correct
26 Correct 193 ms 13992 KB Output is correct
27 Correct 119 ms 14164 KB Output is correct
28 Correct 720 ms 12204 KB Output is correct
29 Correct 507 ms 13652 KB Output is correct
30 Correct 94 ms 12344 KB Output is correct
31 Correct 107 ms 12364 KB Output is correct
32 Correct 893 ms 14200 KB Output is correct
33 Correct 114 ms 14004 KB Output is correct
34 Correct 192 ms 13984 KB Output is correct
35 Correct 115 ms 14160 KB Output is correct