Submission #362780

#TimeUsernameProblemLanguageResultExecution timeMemory
362780mosiashvililukaGame (IOI14_game)C++14
100 / 100
573 ms25312 KiB
#include "game.h" #include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,msh[1509],zm[1509],k[1509][1509],bo[1509]; int fnd(int q){ if(msh[q]==q) return q; else return msh[q]=fnd(msh[q]); } void initialize(int n) { a=n; for(i=0; i<n; i++){ msh[i]=i;zm[i]=1; } for(i=0; i<n; i++){ for(j=0; j<n; j++){ if(i!=j) k[i][j]=1; } } } int hasEdge(int qqa, int qqb) { c=qqa;d=qqb; c=fnd(c);d=fnd(d); if(c==d){ return 0; } if(k[c][d]!=1){ k[c][d]--; k[d][c]--; return 0; }else{ if(zm[c]<zm[d]) swap(c,d); msh[d]=c;bo[d]=1; for(i=0; i<a; i++){ if(i!=c&&bo[i]==0){ k[c][i]=k[c][i]+k[d][i]; k[i][c]=k[c][i]; } } return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...