Submission #986362

#TimeUsernameProblemLanguageResultExecution timeMemory
986362PyqeGame (IOI14_game)C++17
100 / 100
351 ms36680 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; long long n,dsu[1569],cc[1569],am[1569][1569]; long long fd(long long x) { if(dsu[x]!=x) { dsu[x]=fd(dsu[x]); } return dsu[x]; } void initialize(int on) { long long i; n=on; for(i=0;i<n;i++) { dsu[i]=i; cc[i]=1; } } int hasEdge(int x,int y) { long long i; x=fd(x); y=fd(y); am[x][y]++; am[y][x]++; if(am[x][y]<cc[x]*cc[y]) { return 0; } else { am[x][y]=0; am[y][x]=0; for(i=0;i<n;i++) { am[x][i]+=am[y][i]; am[i][x]+=am[i][y]; } cc[x]+=cc[y]; dsu[y]=x; return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...