제출 #595460

#제출 시각아이디문제언어결과실행 시간메모리
595460mosiashvililuka게임 (IOI14_game)C++14
100 / 100
371 ms17604 KiB
#include<bits/stdc++.h> #include "game.h" using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,k[1509][1509],msh[1509],zm[1509]; void initialize(int Nn) { a=Nn; for(i=1; i<a; i++){ for(j=i+1; j<=a; j++){ k[i][j]=k[j][i]=1; } } for(i=1; i<=a; i++){ msh[i]=i;zm[i]=1; } } int fnd(int q){ if(msh[q]==q) return q; else return msh[q]=fnd(msh[q]); } int hasEdge(int Uu, int Vv) { c=Uu+1;d=Vv+1; c=fnd(c);d=fnd(d); k[c][d]--;k[d][c]--; if(k[c][d]==0){ if(zm[c]<zm[d]) swap(c,d); msh[d]=c; if(zm[c]==zm[d]) zm[c]++; for(i=1; i<=a; i++){ k[c][i]+=k[d][i]; k[i][c]+=k[i][d]; } return 1; }else{ return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...