Submission #1051284

#TimeUsernameProblemLanguageResultExecution timeMemory
1051284TAhmed33Game (IOI14_game)C++98
100 / 100
210 ms25260 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; //#include "grader.cpp" int n; int par[1502]; int cur2[1502][1502]; void initialize (int N) { n = N; for (int i = 0; i < n; i++) { par[i] = i; } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { cur2[i][j] = cur2[j][i] = 1; } } } int find (int x) { return par[x] == x ? x : par[x] = find(par[x]); } int hasEdge (int u, int v) { u = find(u); v = find(v); if (u == v) return 0; if (cur2[u][v] != 1) { cur2[u][v]--; cur2[v][u]--; return 0; } for (int i = 0; i < n; i++) { if (i != u && i != v) { cur2[v][i] += cur2[u][i]; cur2[i][v] += cur2[u][i]; } } par[u] = v; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...