Submission #675581

#TimeUsernameProblemLanguageResultExecution timeMemory
675581GudStonksKutije (COCI21_kutije)C++17
35 / 70
1077 ms28260 KiB
#include<bits/stdc++.h> using namespace std; bool us[1005][1005]; set<int>g[1005]; int m, n, q; void dfs(int v, int st) { us[st][v] = 1; for(auto to : g[v]) { if(!us[st][to]) dfs(to, st); } } void fun() { cin>>m>>n>>q; for(int i = 1; i <= n; i++) { for(int j = 1, a; j <= m; j++) { cin>>a; g[a].insert(j); } } for(int i = 1; i <= m; i++) { dfs(i, i); } for(int i = 1, a, b; i <= q; i++) { cin>>a>>b; cout<<((us[a][b]) ? "DA" : "NE")<<"\n"; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int ttt = 1; //cin>>ttt; while(ttt--) fun(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...