제출 #930565

#제출 시각아이디문제언어결과실행 시간메모리
930565vjudge1게임 (IOI14_game)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; #define pb push_back vector<vector<int>> graph; vector<int> added, asked; int cnt = 1; void initialize(int n) { graph.resize(n); added.resize(n); asked.resize(n); added[0] = 1; } int hasEdge(int u, int v) { if ((added[u] and added[v]) or (!added[u] and !added[v])) { graph[u].pb(v); graph[v].pb(u); return 0; } if (added[v]) swap(u, v); if (cnt - asked[v] == 1) { cnt++; for (auto tov : graph[v]) asked[tov]++; added[v] = 1; return 1; } asked[v]++; return 0; } 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; }

컴파일 시 표준 에러 (stderr) 메시지

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