Submission #960655

#TimeUsernameProblemLanguageResultExecution timeMemory
960655IUA_HasinGame (IOI14_game)C++17
100 / 100
315 ms44540 KiB
#include <bits/stdc++.h> #define endl "\n" #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define ll long long using namespace std; #include "game.h" const ll N = 1500; vector<ll> vec[N]; ll vis[N], deg[N]; ll cnt, a, vertex_count; void initialize(int n) { cnt = 0; vertex_count = 0; a = n; } int hasEdge(int u, int v) { vec[u].push_back(v); vec[v].push_back(u); if(cnt==0){ vis[u] = 1; vis[v] = 1; vertex_count = 2; cnt++; return 1; } else { if(vis[u]==0 && vis[v]==0){ return 0; } else if(vis[u]==1 && vis[v]==1){ return 1; } else { if(vis[u]==0 && vis[v]==1){ if(deg[u]==vertex_count-1){ vis[u] = 1; vertex_count++; deg[u]++; for(int i=0; i<vec[u].size(); i++){ ll a = vec[u][i]; deg[a]++; } return 1; } else { deg[u]++; return 0; } } else if(vis[u]==1 && vis[v]==0){ if(deg[v]==vertex_count-1){ vis[v] = 1; vertex_count++; deg[v]++; for(int i=0; i<vec[v].size(); i++){ ll a = vec[v][i]; deg[a]++; } return 1; } else { deg[v]++; return 0; } } } } }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:44:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |                     for(int i=0; i<vec[u].size(); i++){
      |                                  ~^~~~~~~~~~~~~~
game.cpp:58:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |                     for(int i=0; i<vec[v].size(); i++){
      |                                  ~^~~~~~~~~~~~~~
game.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...