Submission #391405

#TimeUsernameProblemLanguageResultExecution timeMemory
391405ali_tavakoliPipes (CEOI15_pipes)C++14
Compilation error
0 ms0 KiB
//In The Name Of Allah #include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second //#pragma GCC optimize("Ofast") const int maxn = 1e5 + 5, maxlog = 19; int n, m, pr[maxn], x, y; int getpar(int v) { if(pr[v] == 0) return pr[v] = v; return (v == pr[v] ? v : pr[v] = getpar(pr[v])); } void un(int v, int u) { v = getpar(v); u = getpar(u); if(u != v) par[u] = v; } int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> m; for(int i = 0; i < m; i++) { cin >> x >> y; un(x, y); } cin.seekg(0); for(int i = 0; i < m; i++) { cin >> x >> y; } } /* 10 11 1 7 1 8 1 6 2 8 6 7 5 8 2 5 2 3 2 4 3 4 10 9 */

Compilation message (stderr)

pipes.cpp: In function 'void un(int, int)':
pipes.cpp:28:9: error: 'par' was not declared in this scope; did you mean 'pr'?
   28 |         par[u] = v;
      |         ^~~
      |         pr