제출 #1271992

#제출 시각아이디문제언어결과실행 시간메모리
1271992thuhienne게임 (IOI14_game)C++20
컴파일 에러
0 ms0 KiB
#include "game.h" int root[1509],size[1509],edge[1509][1509],n; //root i: dsu bth //edge i j: da co bao nhieu canh duoc hoi giua 2 tplt co i lam root va j lam root void initialize(int _n) { n = _n; for (int i = 1;i <= n;i++) root[i] = i,size[i] = 1; } int hasEdge(int u, int v) { int ru = getroot(u),rv = getroot(v); edge[ru][rv]++;edge[rv][ru]++; if (edge[ru][rv] == size[ru] * size[rv]) { return 1; root[ru] = rv; for (int i = 1;i <= n;i++) { edge[i][rv] += edge[i][ru]; edge[rv][i] += edge[ru][i]; } } else return 0; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:13:18: error: 'getroot' was not declared in this scope; did you mean 'root'?
   13 |         int ru = getroot(u),rv = getroot(v);
      |                  ^~~~~~~
      |                  root
game.cpp:15:18: error: 'rv' was not declared in this scope; did you mean 'ru'?
   15 |         edge[ru][rv]++;edge[rv][ru]++;
      |                  ^~
      |                  ru
game.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^