Submission #422129

#TimeUsernameProblemLanguageResultExecution timeMemory
422129daanolavGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include <cstdio> #include <cassert> #include <vector> #include "game.h" using namespace std; #define MAXN 1000001 typedef vector<int> vi; int n; int read_int() { int x; assert(scanf("%d", &x) == 1); return x; } int ufParent[MAXN]; int ufSize[MAXN]; int ufLinkingPossibilities[MAXN]; vi ufPossibleConnections[MAXN]; int ufFind(int a) { if(ufParent[a] == a) { return a; } ufParent[a] = ufFind(ufParent[a]); return ufParent[a]; } void ufUnite(int a, int b) { a = ufFind(a); b = ufFind(b); if(ufSize[a] > ufSize[b]) { swap(a,b); } ufParent[b] = a; ufSize[a] += ufSize[b]; for(int i = 0; i < n; ++i) { if(i == a || i == b) { //ufLinkingPossibilities[a] -= ufPossibleConnections[a][i]; ufPossibleConnections[a][i] = 0; } else { ufPossibleConnections[a][i] += ufPossibleConnections[b][i]; //ufLinkingPossibilities[a] += ufPossibleConnections[b][i]; ufPossibleConnections[i][a] += ufPossibleConnections[i][b]; ufPossibleConnections[i][b] = 0; } } } void initialize(int n) { for(int i = 0; i < n; ++i) { ufParent[i] = i; ufSize[i] = 1; ufLinkingPossibilities[i] = 0; for(int j = 0; j < n; ++j) { if(i == j) { ufPossibleConnections[i].push_back(0); continue; } ufPossibleConnections[i].push_back(1); ufLinkingPossibilities[i] += 1; } } } int hasEdge(int u,int v) { if(ufPossibleConnections[ufFind(u)][ufFind(v)] > 1) { return 0; } else { ufUnite(u,v); return 1; } } int main() { int u, v, r; n = read_int(); initialize(n); r = n * (n - 1) / 2; for (int i = 0; i < r; i++) { u = read_int(); v = read_int(); printf("%d\n", hasEdge(u, v)); } return 0; }

Compilation message (stderr)

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