제출 #782227

#제출 시각아이디문제언어결과실행 시간메모리
782227Andrey게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; int br[1501][1501]; vector<int> dsu(1501); int k; int calc(int a) { while(dsu[a] != a) { a = dsu[a]; } return a; } void initialize(int n) { int a = 1/0; k = n; for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { br[i][j] = 1; } } for(int i = 1; i <= n; i++) { dsu[i] = i; } } int hasEdge(int u, int v) { int a = 1/0; srand(time(NULL)); int a = calc(u),b = calc(v); if(br[a][b] == 1) { br[a][b] = 0; br[b][a] = 0; dsu[b] = a; for(int i = 1; i <= k; i++) { br[a][i] = br[a][i]+br[b][i]; br[i][a] = br[a][i]; } int x = 1/0; return 1/0; } else { br[a][b]--; br[b][a]--; return 0; } }

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

game.cpp: In function 'void initialize(int)':
game.cpp:17:14: warning: division by zero [-Wdiv-by-zero]
   17 |     int a = 1/0;
      |             ~^~
game.cpp:17:9: warning: unused variable 'a' [-Wunused-variable]
   17 |     int a = 1/0;
      |         ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:30:14: warning: division by zero [-Wdiv-by-zero]
   30 |     int a = 1/0;
      |             ~^~
game.cpp:32:9: error: redeclaration of 'int a'
   32 |     int a = calc(u),b = calc(v);
      |         ^
game.cpp:30:9: note: 'int a' previously declared here
   30 |     int a = 1/0;
      |         ^
game.cpp:41:18: warning: division by zero [-Wdiv-by-zero]
   41 |         int x = 1/0;
      |                 ~^~
game.cpp:42:17: warning: division by zero [-Wdiv-by-zero]
   42 |         return 1/0;
      |                ~^~
game.cpp:41:13: warning: unused variable 'x' [-Wunused-variable]
   41 |         int x = 1/0;
      |             ^