제출 #779468

#제출 시각아이디문제언어결과실행 시간메모리
779468Dakto게임 (IOI14_game)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int n; vector<set<int>> gr; void initialize(int N){ n=N; gr.resize(n); for(int i=0; i<n; i++){ for(int j=i+1; j<n; j++){ gr[i].insert(j); gr[j].insert(i); } } } int hasEdge(int u, int v){ vector<bool> seen(n,0); queue<int> q; q.push(u); seen[u]=1; while(!q.empty){ auto t=q.front(); if(t==v){ gr[u].erase(v); gr[v].erase(u); return 0; } for(auto i:gr[t]){ if(t==u && i==v) continue; if(!seen[i]){ seen[i]=1; q.push(i); } } } return 1; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:25:14: error: cannot convert 'std::queue<int>::empty' from type 'bool (std::queue<int>::)() const' to type 'bool'
   25 |     while(!q.empty){
      |              ^~~~~
game.cpp:25:14: error: in argument to unary !
   25 |     while(!q.empty){
      |            ~~^~~~~