제출 #163478

#제출 시각아이디문제언어결과실행 시간메모리
163478GioChkhaidze게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h"
using namespace std;
void initialize(int n) {
  int a[n+5];
  for (int i=0; i<n; i++) 
    a[i]=n-1;
}

int hasEdge(int u,int v) {
	if (a[u]==1 || a[v]==1) return 1;
  	a[u]--,a[v]--;
  	return 0;
}

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

game.cpp: In function 'void initialize(int)':
game.cpp:4:7: warning: variable 'a' set but not used [-Wunused-but-set-variable]
   int a[n+5];
       ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:10:6: error: 'a' was not declared in this scope
  if (a[u]==1 || a[v]==1) return 1;
      ^
game.cpp:11:4: error: 'a' was not declared in this scope
    a[u]--,a[v]--;
    ^