제출 #168348

#제출 시각아이디문제언어결과실행 시간메모리
168348mat_v게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "game.h" #define maxn using namespace std; int dsu[2505]; int ima[2505][2505]; vector<int> graf[2505]; bool bio[2505]; int n; void init(){ for(int i=1; i<=n; i++)dsu[i] = i; } int findpar(int x){ if(x == dsu[x])return x; return dsu[x] = findpar(dsu[x]); } int uk = 0; void unite(int x, int y){ uk--; int a = findpar(x); int b = findpar(y); dsu[a] = b; } void dfs(int x){ bio[x] = 1; for(int i=1; i<=n; i++){ if(!bio[i]){ if(ima[x][i] != 2)dfs(i); } } } void probaj(int src){ for(int i=1; i<=n; i++)bio[i] = 0; dfs(src); } void initialize(int m) { n = m; uk = n; init(); } int hasEdge(int u, int v) { probaj(u); if(bio[v]){ ima[u][v] = ima[v][u] = 2; return 0; } else{ ima[u][v] = ima[v][u] = 1; return 1; } } int main() { int a, b, c; a = read_int(); initialize(a); for (int i = 0; i < n * (n - 1) / 2; i++) { b = read_int(); c = read_int(); printf("%d\n", hasEdge(u, v)); } return 0; }

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

game.cpp: In function 'int main()':
game.cpp:57:9: error: 'read_int' was not declared in this scope
     a = read_int();
         ^~~~~~~~
game.cpp:57:9: note: suggested alternative: 'rewind'
     a = read_int();
         ^~~~~~~~
         rewind
game.cpp:62:32: error: 'u' was not declared in this scope
         printf("%d\n", hasEdge(u, v));
                                ^
game.cpp:62:35: error: 'v' was not declared in this scope
         printf("%d\n", hasEdge(u, v));
                                   ^