Submission #782187

#TimeUsernameProblemLanguageResultExecution timeMemory
782187AndreyGame (IOI14_game)C++14
0 / 100
1 ms340 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; int br[1501][1501]; vector<int> dsu(1501); int k; int calc(int a) { while(dsu[a] != a) { a = dsu[a]; } return a; } void initialize(int n) { k = n; for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { br[i][j] = 1; } } for(int i = 1; i <= n; i++) { dsu[i] = i; } } int hasEdge(int u, int v) { int ans,a = calc(u),b = calc(v); if(br[a][b] == 1) { br[a][b] = 0; br[b][a] = 0; ans = 0; dsu[b] = a; for(int i = 1; i <= k; i++) { br[a][i] = br[a][i]+br[b][i]; br[i][a] = br[a][i]; } } else { ans = 1; br[a][b]--; br[b][a]--; } return rand()%2; }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:29:9: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   29 |     int ans,a = calc(u),b = calc(v);
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...