제출 #59259

#제출 시각아이디문제언어결과실행 시간메모리
59259TadijaSebez게임 (IOI14_game)C++11
100 / 100
751 ms160020 KiB
#include "game.h" #include <stdio.h> const int N=1505; int p[N],d[N][N],n; int Find(int x){ return p[x]==x?x:p[x]=Find(p[x]);} void initialize(int N) { int i,j;n=N; for(i=1;i<=n;i++) p[i]=i; for(i=1;i<=n;i++) for(j=i+1;j<=n;j++) d[i][j]=1; } int min(int a, int b){ return a>b?b:a;} int max(int a, int b){ return a>b?a:b;} int hasEdge(int u, int v) { int i; u=Find(u+1); v=Find(v+1); if(u==v) return 0; if(u>v) u^=v,v^=u,u^=v; if(d[u][v]==1) { d[u][v]--; for(i=1;i<=n;i++) d[min(u,i)][max(u,i)]+=d[min(v,i)][max(i,v)]; p[v]=u; return 1; } else { d[u][v]--; return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...