Submission #109216

#TimeUsernameProblemLanguageResultExecution timeMemory
109216nvmdavaGame (IOI14_game)C++17
100 / 100
848 ms25380 KiB
#include "game.h" #define N 1501 int p[N], sz[N]; int cnt[N][N]; int find(int x){ return (x == p[x] ? x : p[x] = find(p[x])); } void initialize(int n){ for(int i = 0; i < n; i++) p[i] = i, sz[i] = 1; } int hasEdge(int u, int v) { v = find(v); u = find(u); cnt[v][u]++; cnt[u][v]++; if(cnt[v][u] != sz[v] * sz[u]) return 0; if(v > u){ int a = v; v = u; u = a; } p[u] = v; sz[v] += sz[u]; for(int i = 0; i < N; i++)cnt[v][i] += cnt[u][i], cnt[i][v] = cnt[v][i]; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...