Submission #577838

#TimeUsernameProblemLanguageResultExecution timeMemory
577838alirezasamimi100Game (IOI14_game)C++17
100 / 100
393 ms15820 KiB
#include "game.h" const int N = 1.5e3 + 10; int rq[N][N], p[N], n; int gp(int x){ return p[x]==x ? x : p[x]=gp(p[x]); } void uni(int x, int y){ p[y] = x; for(int i = 0; i < n; i++){ rq[i][x] += rq[i][y]; rq[i][y] = 0; rq[x][i] += rq[y][i]; } } void initialize(int wtn) { n = wtn; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ rq[i][j] = 1; } rq[i][i] = 0; p[i] = i; } } int hasEdge(int u, int v) { u = gp(u); v = gp(v); rq[v][u]--; rq[u][v]--; if(!rq[u][v]){ uni(u, v); return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...