Submission #105026

#TimeUsernameProblemLanguageResultExecution timeMemory
105026WLZGame (IOI14_game)C++17
42 / 100
1033 ms12692 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; vector< set<int> > g; vector<int> was; void initialize(int n) { g.resize(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 u) { was[u] = 1; for (auto& v : g[u]) { if (!was[v]) { dfs(v); } } } int hasEdge(int u, int v) { g[u].erase(v); g[v].erase(u); was.assign((int) g.size(), 0); dfs(u); if (was[v]) { return 0; } g[u].insert(v); g[v].insert(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...