Submission #362714

#TimeUsernameProblemLanguageResultExecution timeMemory
362714mosiashvililukaGame (IOI14_game)C++14
0 / 100
1 ms364 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]; int fnd(int q){ if(msh[q]==q) return q; else return msh[q]=fnd(msh[q]); } void mrg(int q, int w, int rr){ q=fnd(q);w=fnd(w); if(q==w) return; if(zm[q]<zm[w]) swap(q,w); msh[w]=q; k[q]=rr; if(zm[q]==zm[w]) zm[q]++; } void initialize(int n) { for(i=0; i<n; i++){ msh[i]=i;zm[i]=1;k[i]=n-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]!=1&&k[d]!=1){ k[c]--;k[d]--; return 0; }else{ if(k[c]==1){ mrg(c,d,k[d]); return 1; } if(k[d]==1){ mrg(c,d,k[c]); return 1; } } }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...