Submission #599997

#TimeUsernameProblemLanguageResultExecution timeMemory
599997daisy2Game (IOI14_game)C++14
100 / 100
381 ms10304 KiB
#include "game.h" #include<vector> using namespace std; int par[1505]; bool used[1505][1505]; vector<int> com; void initialize(int n) { com.push_back(1); for(int i=1;i<=n;i++) { par[i]=i; } } int find_par(int vr) { if(vr==par[vr]) return vr; return par[vr]=find_par(par[vr]); } int hasEdge(int u, int v) { u++;v++; used[u][v]=used[v][u]=1; u=find_par(u); v=find_par(v); if(u!=1 && v!=1) return 0; if(u==1 && v==1) return 0; if(v==1) swap(u,v); for(int i=0;i<com.size();i++) { if(!used[v][com[i]]) { return 0; } } par[v]=u; com.push_back(v); return 1; }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:36:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0;i<com.size();i++)
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...