Submission #729161

#TimeUsernameProblemLanguageResultExecution timeMemory
729161sofija6Game (IOI14_game)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #define MAXN 1510 using namespace std; set<int> G[MAXN],a,b; void initialize(int n) { for (int i=0;i<n;i++) { for (int j=0;j<n;j++) { if (i!=j) G[i].insert(j); } } } void DFS(int i,pair<int,int> skipp,set<int> &s) { s.insert(i); for (int next : G[i]) { if ((i==skipp.first && next==skipp.second) || (i==skipp.second && next==skipp.first)) continue; if (!s.count(next)) { s.insert(next); DFS(next,skipp,s); } } } bool Check(int u,int v) { a.clear(); b.clear(); DFS(u,{u,v},a); DFS(v,{u,v},b); for (auto i : a) { if (!b.count(i)) return true; } for (auto i : b) { if (!a.count(i)) return true; } } int hasEdge(int u, int v) { if (Check(u,v)) return true; G[u].erase(v); G[v].erase(u); return false; }

Compilation message (stderr)

game.cpp: In function 'bool Check(int, int)':
game.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...