Submission #511339

#TimeUsernameProblemLanguageResultExecution timeMemory
511339jk410Game (IOI14_game)C++17
100 / 100
396 ms16996 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; int N; int Par[1500]; int Cnt[1500][1500]; int get_par(int v){ if (v==Par[v]) return v; return Par[v]=get_par(Par[v]); } void initialize(int n){ N=n; for (int i=0; i<N; i++){ Par[i]=i; for (int j=0; j<N; j++) Cnt[i][j]=1; } } int hasEdge(int u,int v){ u=get_par(u); v=get_par(v); if (u==v) return 1; if (Cnt[u][v]==1){ for (int i=0; i<N; i++){ Cnt[u][i]+=Cnt[v][i]; Cnt[i][u]+=Cnt[i][v]; Cnt[v][i]=Cnt[i][v]=0; } Par[v]=u; return 1; } Cnt[u][v]--; Cnt[v][u]--; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...