제출 #992467

#제출 시각아이디문제언어결과실행 시간메모리
992467Alfraganus게임 (IOI14_game)C++17
42 / 100
1020 ms2672 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> graph; void initialize(int n) { graph.resize(n); for(int i = 0; i < n; i ++) for(int j = i + 1; j < n; j ++) graph[i].push_back(j), graph[j].push_back(i); } int hasEdge(int u, int v) { vector<int> p; for(auto x : graph[u]) if(x != v) p.push_back(x); graph[u] = p; p.clear(); for(auto x : graph[v]) if(x != u) p.push_back(x); graph[v] = p; vector<bool> used(graph.size()); int cnt = 1; deque<int> q; q.push_back(u); used[u] = 1; while(!q.empty()){ int u = q.front(); q.pop_front(); for(auto x : graph[u]){ if(!used[x]){ used[x] = true; q.push_back(x); cnt ++; } } } if(cnt == graph.size()) return 0; graph[u].push_back(v); graph[v].push_back(u); return 1; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:42:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     if(cnt == graph.size())
      |        ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...