Submission #700846

#TimeUsernameProblemLanguageResultExecution timeMemory
700846primenumber_zzRail (IOI14_rail)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int N; int cnt,res; vector<int>road[1515]; struct UnionFind { vector<int>par,size,cnt; vector<vector<int>>cld; UnionFind() {}; UnionFind(int n) { par.resize(n); size.resize(n,1); cnt.resize(n); cld.resize(n); for(int i = 0; i < n; i++) { par[i] = i; cld[i].push_back(i); } } int find(int x) { if(par[x] == x) { return x; } return par[x] = find(par[x]); } bool same(int u,int v) { u = find(u); v = find(v); return (u == v); } void unite(int u,int v) { u = find(u); v = find(v); if(u == v) return; if(size[u] > size[v]) swap(u,v); for(int i:cld[u]) { cld[v].push_back(i); for(int j:road[i]) { if(!same(i,j) && same(j,v)) { cnt[v] -= 2; } } } par[u] = v; size[v] += size[u]; cnt[v] += cnt[u]; } int consize(int x) { x = find(x); return size[x]; } int concnt(int x) { x = find(x); return cnt[x]; } }; UnionFind uf; void initialize(int n) { N = n; cnt = 0; res = n-1; UnionFind init(n); uf = init; } int hasEdge(int u, int v){ if(uf.same(u,v)) { return 0; } int a = uf.consize(u); int b = uf.concnt(u); if(a*(N-a) == b+1) { uf.unite(u,v); res--; return 1; } a = uf.consize(v); b = uf.concnt(v); if(a*(N-a) == b+1) { uf.unite(u,v); res--; return 1; } if(N*(N-1)/2-cnt == res) { res--; uf.unite(u,v); return 1; } uf.cnt[uf.find(u)]++; uf.cnt[uf.find(v)]++; cnt++; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc8eqDlW.o:(.bss+0x0): multiple definition of `cnt'; /tmp/ccyEfIiS.o:(.bss+0x8e6c): first defined here
/usr/bin/ld: /tmp/cc8eqDlW.o: in function `main':
grader.cpp:(.text.startup+0x2d9): undefined reference to `findLocation'
collect2: error: ld returned 1 exit status