Submission #332184

#TimeUsernameProblemLanguageResultExecution timeMemory
332184zggfGame (IOI14_game)C++14
100 / 100
562 ms25452 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; vector<int> conv; vector<vector<int>> tab; void initialize(int n) { conv.resize(n); tab.resize(n, vector<int>(n, 1)); for(int i = 0; i < n; i++){ conv[i] = i; } } int find(int x){ if(conv[x]==x) return x; conv[x] = find(conv[x]); return conv[x]; } void merge(int a, int b){ conv[b] = a; for(int i = 0; i < tab.size(); i++){ tab[a][i] += tab[b][i]; tab[i][a] += tab[i][b]; } } int hasEdge(int u, int v) { u = find(u); v = find(v); if(tab[u][v]==1) { merge(u, v); return 1; } tab[u][v]--; tab[v][u]--; return 0; }

Compilation message (stderr)

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