Submission #1062163

#TimeUsernameProblemLanguageResultExecution timeMemory
1062163andrei_iorgulescuGame (IOI14_game)C++14
100 / 100
242 ms26464 KiB
#include <bits/stdc++.h> #include "game.h" #warning That's not FB, that's my FB using namespace std; int n; int sz[1505], t[1505]; int cnt[1505][1505]; void initialize(int N) { n = N; for (int i = 1; i <= n; i++) t[i] = i, sz[i] = 1; } int par(int x) { while (x != t[x]) x = t[x]; return x; } int hasEdge(int u, int v) { u++; v++; int ru = u, rv = v; u = par(u), v = par(v); if (u == v) assert(false); if (sz[u] < sz[v]) swap(u,v); if (cnt[v][u] != sz[u] * sz[v] - 1) { cnt[v][u]++; cnt[u][v]++; return 0; } sz[u] += sz[v]; t[v] = u; for (int x = 1; x <= n; x++) { if (t[x] == x and x != u and x != v) { cnt[x][u] += cnt[x][v]; cnt[u][x] += cnt[v][x]; } } return 1; }

Compilation message (stderr)

game.cpp:3:2: warning: #warning That's not FB, that's my FB [-Wcpp]
    3 | #warning That's not FB, that's my FB
      |  ^~~~~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:29:9: warning: unused variable 'ru' [-Wunused-variable]
   29 |     int ru = u, rv = v;
      |         ^~
game.cpp:29:17: warning: unused variable 'rv' [-Wunused-variable]
   29 |     int ru = u, rv = v;
      |                 ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...