Submission #1016517

#TimeUsernameProblemLanguageResultExecution timeMemory
1016517n3rm1nGame (IOI14_game)C++17
0 / 100
1 ms2548 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; const int MAXN = 2e3 + 10; int vcnt; int used[MAXN][MAXN]; vector < int > g[MAXN]; void initialize(int n) { vcnt = n; } int visited[MAXN], viscnt = 0; void dfs(int beg) { visited[beg] = 1; viscnt ++; int nb; for (int i = 0; i < g[beg].size(); ++ i) { nb = g[beg][i]; if(!visited[nb])dfs(nb); } } int hasEdge(int u, int v) { viscnt = 0; memset(visited, 0, sizeof(visited)); g[u].push_back(v); g[v].push_back(u); dfs(0); //cout << "after connecting = "<< viscnt << endl; if(viscnt == vcnt) /// svyrzva { g[u].pop_back(); g[v].pop_back(); return 0; } g[u].pop_back(); g[v].pop_back(); /* for (int i = 0; i < vcnt; ++ i) { for (int j = i+1; j < vcnt; ++ j) { if(!used[i][j] && !(i == min(u, v) && j == (max(u, v)))) { g[i].push_back(j); g[j].push_back(i); } } } viscnt = 0; memset(visited, 0, sizeof(visited)); dfs(0); if(viscnt != vcnt) { for (int i = 0; i < vcnt; ++ i) { while(g[i].size()) { int nb = g[i].back(); if(used[i][nb])break; g[i].pop_back(); } } used[u][v] = 1; used[v][u] = 1; return 1; }*/ g[u].push_back(v); g[v].push_back(u); used[u][v] = 1; used[v][u] = 1; return 1; }

Compilation message (stderr)

game.cpp: In function 'void dfs(int)':
game.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i = 0; i < g[beg].size(); ++ i)
      |                     ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...