Submission #66999

#TimeUsernameProblemLanguageResultExecution timeMemory
66999CrownGame (IOI14_game)C++14
0 / 100
3 ms588 KiB
#include "game.h" #include <bits/stdc++.h> const int maxn = 1505; int p[maxn]; int bw[maxn][maxn]; int n; void initialize(int _n) { n = _n; for(int i = 0; i< n; i++) p[i] = i; for(int i = 0; i< n; i++) { for(int j = i+1; j< n; j++) { bw[i][j] = bw[j][i] = 1; } } } int findset(int x) { if(p[x] == x) return x; return p[x] = findset(p[x]); } void unionset(int x, int y) { int a = findset(x), b = findset(y); for(int i = 0; i< n; i++) { bw[x][i] += bw[y][i]; bw[i][x] += bw[i][y]; } } int hasEdge(int u, int v) { int x = findset(u), y = findset(v); int res = 0; assert(x != y); if(x != y && bw[x][y] == 1) res = 1; bw[x][y]--; bw[y][x]--; if(res) { unionset(x, y); } return res; }

Compilation message (stderr)

game.cpp: In function 'void unionset(int, int)':
game.cpp:30:6: warning: unused variable 'a' [-Wunused-variable]
  int a = findset(x), b = findset(y);
      ^
game.cpp:30:22: warning: unused variable 'b' [-Wunused-variable]
  int a = findset(x), b = findset(y);
                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...