Submission #429561

#TimeUsernameProblemLanguageResultExecution timeMemory
429561TLP39Game (IOI14_game)C++14
100 / 100
504 ms25480 KiB
#include "game.h" #include<bits/stdc++.h> int n; std :: vector<int> ver[1503]; int par[1503]; int link[1503][1503]; void initialize(int N) { n=N; for(int i=0;i<n;i++) { par[i]=i; ver[i].push_back(i); } memset(link,0,sizeof link); } int hasEdge(int u, int v) { int x=par[u],y=par[v]; if(link[x][y]!=(ver[x].size())*(ver[y].size())-1) { link[x][y]++; link[y][x]++; return 0; } for(int i=0;i<ver[y].size();i++) { ver[x].push_back(ver[y][i]); par[ver[y][i]]=x; } ver[y].clear(); for(int i=0;i<n;i++) { if(!ver[i].size() || i==x) continue; link[x][i]+=link[y][i]; link[y][i]=0; link[i][y]=0; link[i][x]=link[x][i]; } return 1; }

Compilation message (stderr)

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