제출 #835236

#제출 시각아이디문제언어결과실행 시간메모리
835236Liudas게임 (IOI14_game)C++17
0 / 100
0 ms212 KiB
#include <iostream> #include <numeric> #include <vector> #include <set> using namespace std; vector<set<int>> can; vector<int> par; int get(int x){ if(par[x] != x){ return par[x] = get(par[x]); } return x; } void merge(int u, int v){ par[u] = v; } void initialize(int N){ par.resize(N); set<int> con; for(int i = 0; i < N; i ++){ con.insert(i); } can.resize(N); for(int i = 0; i < N; i ++){ con.erase(i); can[i] = con; con.insert(i); } iota(par.begin(), par.end(), 0); } int hasEdge(int u, int v){ u = get(u); v = get(v); if(u == v){return 0;} can[u].erase(v); can[v].erase(u); if(can[u].size() == 0){ merge(u, v); for(int i = 0; i < par.size(); i ++){ if(par[i] == u){ can[v].erase(i); } } return 1; } if(can[v].size() == 0){ merge(v, u); for(int i = 0; i < par.size(); i ++){ if(par[i] == v){ can[u].erase(i); } } return 1; } return 0; }

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:39:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(int i = 0; i < par.size(); i ++){
      |                        ~~^~~~~~~~~~~~
game.cpp:48:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         for(int i = 0; i < par.size(); i ++){
      |                        ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...