Submission #428320

#TimeUsernameProblemLanguageResultExecution timeMemory
428320Rouge_HugoGame (IOI14_game)C++14
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> #include "game.h" #define ll long long #define fi first #define se second #define pb push_back using namespace std; int n; const int N=100; int pa[N],sz[N],vis[N][N]; vector<int>v[N]; void merge(int x,int y) { if(sz[x]<sz[y])swap(x,y); for(auto it:v[y]) { pa[it]=x; v[x].pb(it); sz[x]++; } v[y].clear(); } void initialize(int N) { n=N; for(int i=0;i<n;i++) { v[i].pb(i); pa[i]=i; sz[i]=1; } } int hasEdge(int x, int y) { if(pa[x]==pa[y])return 1; int xx=x,yy=y; x=pa[x];y=pa[y];int r=0,rr=0; for(auto it:v[x]) { for(int i=0;i<n;i++) { int u=pa[i]; if(u==x)continue; if(vis[it][i])continue; if(i==y)continue; r=1;break; } } for(auto it:v[y]) { for(int i=0;i<n;i++) { int u=pa[i]; if(u==y)continue; if(vis[it][i])continue; if(i==x)continue; rr=1; } } if(r>0&&rr>0) { vis[x][y]=1; vis[y][x]=1; return 0; } merge(x,y); return 1; }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:36:9: warning: unused variable 'xx' [-Wunused-variable]
   36 |     int xx=x,yy=y;
      |         ^~
game.cpp:36:14: warning: unused variable 'yy' [-Wunused-variable]
   36 |     int xx=x,yy=y;
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...