Submission #579167

#TimeUsernameProblemLanguageResultExecution timeMemory
579167Trisanu_DasKutije (COCI21_kutije)C++17
0 / 70
767 ms5640 KiB
#include <bits/stdc++.h> using namespace std; int parent[1001]; int find(int u){ if(u = parent[u]) return u; return parent[u] = find(parent[u]); } void join(int u, int v){ u = find(u); v = find(v); if(u == v) return; parent[v] = u; } int main(){ int n, m, q; cin >> n >> m >> q; for(int i = 1; i < n + 1; i++) parent[i] = i; for(int i = 1; i <= m; i++) { for(int j = 1; j <= n; j++) { int x; cin >> x; if(find(x) != find(j)) join(x, j); } } while(q--){ int a, b; cin >> a >> b; if(find(a) == find(b)) cout << "DE\n"; else cout << "NE\n"; } }

Compilation message (stderr)

Main.cpp: In function 'int find(int)':
Main.cpp:7:8: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
    7 |   if(u = parent[u]) return u;
      |      ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...