Submission #862371

#TimeUsernameProblemLanguageResultExecution timeMemory
862371TAhmed33Kutije (COCI21_kutije)C++98
35 / 70
1058 ms14620 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 () { 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...