Submission #210695

#TimeUsernameProblemLanguageResultExecution timeMemory
210695peuchGame (IOI14_game)C++17
42 / 100
1099 ms2424 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1600; int marcAux; int marc[MAXN]; int cnt; int N; vector<int> ar[MAXN]; void dfs(int cur){ cnt++; marc[cur] = marcAux; for(int i = 0; i < ar[cur].size(); i++){ int viz = ar[cur][i]; if(marc[viz] == marcAux) continue; dfs(viz); } } void initialize(int n) { N = n; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ ar[i].push_back(j); ar[j].push_back(i); } } } int hasEdge(int u, int v) { int id = -1; for(int i = 0; i < ar[u].size(); i++) if(ar[u][i] == v) id = i; if(id < 0) return 0; ar[u].erase(ar[u].begin() + id); for(int i = 0; i < ar[v].size(); i++) if(ar[v][i] == u) id = i; if(id < 0) return 0; ar[v].erase(ar[v].begin() + id); marcAux++; cnt = 0; dfs(0); if(cnt == N) return 0; else{ ar[u].push_back(v); ar[v].push_back(u); return 1; } }

Compilation message (stderr)

game.cpp: In function 'void dfs(int)':
game.cpp:17:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < ar[cur].size(); i++){
                 ~~^~~~~~~~~~~~~~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:36:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < ar[u].size(); i++)
                 ~~^~~~~~~~~~~~~~
game.cpp:40:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < ar[v].size(); i++)
                 ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...