Submission #862372

#TimeUsernameProblemLanguageResultExecution timeMemory
862372TAhmed33Kutije (COCI21_kutije)C++98
35 / 70
1022 ms14156 KiB
#include <bits/stdc++.h> using namespace std; vector <int> adj[1001]; bool vis[1001][1001]; void dfs (int pos, int k) { vis[pos][k] = 1; for (auto j : adj[pos]) { if (!vis[j][k]) { dfs(j, k); } } } int main () { ios::sync_with_stdio(0); cin.tie(0); int n, m, q; cin >> n >> m >> q; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { int x; cin >> x; adj[j].push_back(x); } } for (int i = 1; i <= n; i++) { dfs(i, i); } while (q--) { int a, b; cin >> a >> b; cout << (vis[a][b] ? "DA\n" : "NE\n"); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...