제출 #835250

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

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:32:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         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...