제출 #386653

#제출 시각아이디문제언어결과실행 시간메모리
386653ismoilov게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define rall(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++) #define fv(c) for(int (a) = (1); (a) <= (c); (a)++) #define fz(c) for(int (a) = (0); (a) < (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) #define pb push_back #define in insert #define ss second #define ff first int ad = 0, n; int v[1501]; set <int> a, b; int hasEdge(int x, int y) { if(a.count(x) && a.count(y) || b.count(x) && b.count(y)){ ad ++; return 1; } else{ if(ad == (n-1)*n/2) return 1; ad ++; return 0; } } void initialize(int n) { fp(i,0,n) v[i] = n-1; fp(i,0,n/2) a.in(i); fp(i,n/2,n) b.in(i); while(ad < (n-1)*n/2){ int x, y; cin >> x >> y; return hasEdge(x, y); } }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:25:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |  if(a.count(x) && a.count(y) || b.count(x) && b.count(y)){
      |     ~~~~~~~~~~~^~~~~~~~~~~~~
game.cpp: In function 'void initialize(int)':
game.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
game.cpp:37:2: note: in expansion of macro 'fp'
   37 |  fp(i,0,n)
      |  ^~
game.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
game.cpp:39:2: note: in expansion of macro 'fp'
   39 |  fp(i,0,n/2)
      |  ^~
game.cpp:10:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
game.cpp:41:2: note: in expansion of macro 'fp'
   41 |  fp(i,n/2,n)
      |  ^~
game.cpp:46:22: error: return-statement with a value, in function returning 'void' [-fpermissive]
   46 |   return hasEdge(x, y);
      |                      ^