Submission #595353

#TimeUsernameProblemLanguageResultExecution timeMemory
595353birthdaycakeGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h" #include<bits/stdc++.h> #define endl '\n' #define mod 1000000007 using namespace std; set<int>cnt[2000001]; int adj[1501][1501]; int dsu[2000001],rnk[2000001]; int N; int Find(int x){ if(dsu[x] == x) return x; return dsu[x] = Find(dsu[x]); } void Unite(int a, int b){ a = Find(a); b = Find(b); if(rnk[a] < rnk[b]) swap(a,b); rnk[a] += rnk[b]; dsu[b] = a; for(auto s: cnt[b]){ adj[a][s] += adj[b][s]; adj[s][a] += adj[s][b]; } } void initialize(int n) { N = n; for(int i = 1; i <= n; i++) { dsu[i] = i; rnk[i] = 1; } } int hasEdge(int u, int v) { u++; v++; int set_a = Find(u), set_b = Find(v); if(set_a == set_b) return 0; cnt[set_a].insert(set_b); cnt[set_b].insert(set_a); adj[set_a][set_b]++; adj[set_b][set_a]++; if(adj[set_a][set_b] != rnk[set_b] * rnk[set_a]) return 0; if(adj[set_b][set_a] != rnk[set_a] * rnk[set_b]) return 0; Unite(u,v); return 1; } int read_int() { int x; assert(scanf("%d", &x) == 1); return x; } int main() { int n, u, v; n = read_int(); initialize(n); for (int i = 0; i < n * (n - 1) / 2; i++) { u = read_int(); v = read_int(); printf("%d\n", hasEdge(u, v)); } return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccY8vDVX.o: in function `read_int()':
grader.cpp:(.text+0x0): multiple definition of `read_int()'; /tmp/ccnZZil1.o:game.cpp:(.text+0x470): first defined here
/usr/bin/ld: /tmp/ccY8vDVX.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccnZZil1.o:game.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status