Submission #385913

#TimeUsernameProblemLanguageResultExecution timeMemory
385913victoriadGame (IOI14_game)C++14
15 / 100
2 ms384 KiB
#include "game.h" #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <utility> #include <queue> #include <map> #include <iomanip> #include <stack> #include <fstream> using namespace std; int a,b,x; vector<int>g; void initialize(int n) { a=-1; b=-1; g.assign(n,n-1); x=(n*(n-1))/2; } int hasEdge(int u, int v) { if(g.size()==4){ if(g[u]>2 && g[v]>2){ g[u]--; g[v]--; return 0; } else if(g[u]==1 || g[v]==1){ return 1; } else if(a!=-1 && b!=-1){ return 1; } else if(g[u]==2 && g[v]==2){ if(a==-1 && b==-1){ a=u; b=v; g[u]--; g[v]--; return 0; } else{ return 1; } } else{ if(a==-1){ a=u; g[u]--; g[v]--; return 0; } else if(b==-1){ b=u; g[u]--; g[v]--; return 0; } else{ return 1; } } } else{ x--; if(g[u]>2 && g[v]>2){ g[u]--; g[v]--; return 0; } else if(g[u]==1 || g[v]==1){ return 1; } else if(a!=-1 && b!=-1){ return 1; } else if(g[u]==2 && g[v]==2){ if(a==-1 && b==-1 && x<=2){ a=u; b=v; g[u]--; g[v]--; return 0; } else{ return 1; } } else{ if(a==-1 && b==-1){ a=u; g[u]--; g[v]--; return 0; } else if(a==-1 && x<=g.size()/2){ a=u; g[u]--; g[v]--; return 0; } else if(b==-1 && x<=g.size()/2){ b=u; g[u]--; g[v]--; return 0; } else{ return 1; } } } }

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:98:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   98 |          else if(a==-1 && x<=g.size()/2){
      |                           ~^~~~~~~~~~~~
game.cpp:104:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |         else if(b==-1 && x<=g.size()/2){
      |                          ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...