Submission #235900

#TimeUsernameProblemLanguageResultExecution timeMemory
235900BilyanaGame (IOI14_game)C++17
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; vector<bool> used; vector<set<int>> cons; vector<vector<int>> con; void initialize(int n) { cons.resize(n); con.resize(n); used.resize(n, 0); for (int i=0; i<n; i++) { con[i].resize(n, 0); con[i][i] = 1; for (int j=0; j<n; j++) { if (i != j) { cons[i].insert(j); } } } } void removeEdge(int u, int v) { cons[u].erase(v); cons[v].erase(u); } bool update(int u) { if (cons[u].size() == 1) { int v = *cons[u].begin(); con[u][v] = 1; con[v][u] = 1; removeEdge(u, v); update(v); return 1; } return 0; } int hasEdge(int u, int v) { fill(used.begin(), used.end(), 0); if (con[u][v] == 1) { return 0; } if (con[u][v] == 2) { return 1; } if (update(u) || update(v)) { return 1; } else { removeEdge(u, v); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...