제출 #48330

#제출 시각아이디문제언어결과실행 시간메모리
48330wijw111게임 (IOI14_game)C++14
100 / 100
499 ms19148 KiB
#include "game.h" const int N = 2000; int p[N], c[N], cnt[N][N], pn; void initialize(int n) { pn = n; for(int i=0; i<pn; i++){ p[i] = i; c[i] = 1; } } int hasEdge(int u, int v) { u = p[u]; v = p[v]; cnt[u][v]++; cnt[v][u]++; if(cnt[u][v] == c[u]*c[v]){ c[u] += c[v]; for(int i=0; i<pn; i++){ if(p[i] == v) p[i] = u; cnt[u][i] += cnt[v][i]; cnt[i][u] += cnt[i][v]; } return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...