Submission #66842

#TimeUsernameProblemLanguageResultExecution timeMemory
66842KubalionzzaleGame (IOI14_game)C++14
0 / 100
3 ms556 KiB
#include "game.h" #include <iostream> #include <algorithm> #include <set> #include <vector> std::vector< std::vector<int> > g(1510); int cnt[1510] = { 0 }, cnting = 0; int curi, curj; int n; bool visited[1510] = { 0 }; void dfs(int index) { ++cnting; visited[index] = true; for (int i = 0; i < g[index].size(); ++i) { int next = g[index][i]; if ((curi == index && curj == next) || (curi == next && curj == index)) { continue; } if (!visited[next]) dfs(next); } } void dfss(int index) { for (int i = 0; i < n; ++i) { visited[i] = 0; } dfs(0); } void initialize(int N) { n = N; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (i == j) continue; g[i].push_back(j); g[j].push_back(i); } } } int hasEdge(int u, int v) { curi = u; curj = v; dfss(0); if (cnting == n) { return 0; } else { for (int i = 0; i < g[u].size(); ++i) { if (g[u][i] == v) { g[u].erase(g[u].begin() + i); break; } } for (int i = 0; i < g[v].size(); ++i) { if (g[v][i] == u) { g[v].erase(g[v].begin() + i); break; } } } }

Compilation message (stderr)

game.cpp: In function 'void dfs(int)':
game.cpp:19:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < g[index].size(); ++i)
                     ~~^~~~~~~~~~~~~~~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:69:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < g[u].size(); ++i)
                         ~~^~~~~~~~~~~~~
game.cpp:78:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < g[v].size(); ++i)
                         ~~^~~~~~~~~~~~~
game.cpp:87:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...