Submission #542908

#TimeUsernameProblemLanguageResultExecution timeMemory
542908Vladth11Game (IOI14_game)C++14
100 / 100
375 ms22036 KiB
#include <bits/stdc++.h> #include "game.h" #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <long double, pii> muchie; const ll NMAX = 5001; const ll VMAX = 1000001; const ll INF = (1LL << 60); const ll MOD = 1000000007; const ll BLOCK = 1000000; const ll base = 13137; const ll nr_of_bits = 16; int p[NMAX]; vector <int> comp[NMAX]; int q[NMAX][NMAX]; int N; void initialize(int n) { N = n; for(int i = 0; i < N; i++) { p[i] = i; comp[i].push_back(i); } } int root(int x){ if(x == p[x]) return x; return p[x] = root(p[x]); } int hasEdge(int u, int v) { u = root(u); v = root(v); q[u][v]++; q[v][u]++; if(u == v){ return 1; /// we don't really care } int ok = (q[u][v]) == (comp[u].size() * comp[v].size()); if(!ok){ return 0; } for(int i = 0; i < N; i++){ q[v][i] += q[u][i]; } for(int i = 0; i < N; i++){ q[i][v] += q[i][u]; } for(auto x : comp[u]) comp[v].push_back(x); p[u] = v; return 1; }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:47:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     int ok = (q[u][v]) == (comp[u].size() * comp[v].size());
      |              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...