제출 #20740

#제출 시각아이디문제언어결과실행 시간메모리
20740rose0310게임 (IOI14_game)C++14
0 / 100
0 ms18876 KiB
#include "game.h" int ed[1515][1515]={},N; int p[1515]; void initialize(int n) { N=n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ ed[i][j]=-1; } p[i]=i; } } int find(int x){ if(x==p[x]) return x; return p[x]=find(p[x]); } int hasEdge(int u, int v) { if(ed[u][v]>=0) return ed[u][v]; if(find(u)==find(v)) return ed[u][v]=ed[v][u]=1; if(ed[u][N]>=N-2 || ed[v][N]>=N-2) { p[find(u)]=find(v); return ed[u][v]=ed[v][u]=1; } else{ ed[u][N]++; ed[v][N]++; return ed[u][v]=ed[v][u]=0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...