Submission #920658

#TimeUsernameProblemLanguageResultExecution timeMemory
920658MackerGame (IOI14_game)C++17
42 / 100
1066 ms13144 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(v) v.begin(), v.end() vector<set<int>> adj; set<int> active; int n; bool dfs(int a, int f){ bool ret = 0; //if(adj[a].size() < active.size()){ for (auto &b : adj[a]) { if(active.find(b) != active.end()){ active.erase(b); if(b == f) return 1; if(dfs(b, f)) return 1; } } /* } else{ set<int> tmp = active; for (auto &b : tmp) { if(adj[a].find(b) != adj[a].end()){ active.erase(b); if(b == f) return 1; if(dfs(b, f)) return 1; } } } */ return 0; } void initialize(int N) { n = N; adj.resize(n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if(j != i) adj[i].insert(j); } } } int hasEdge(int u, int v) { for (int i = 0; i < n; i++) { active.insert(i); } adj[u].erase(v); adj[v].erase(u); if(dfs(u, v)) return 0; else { adj[u].insert(v); adj[v].insert(u); return 1; } }

Compilation message (stderr)

game.cpp: In function 'bool dfs(int, int)':
game.cpp:13:10: warning: unused variable 'ret' [-Wunused-variable]
   13 |     bool ret = 0;
      |          ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...