Submission #1125818

#TimeUsernameProblemLanguageResultExecution timeMemory
1125818makmed1337Game (IOI14_game)C++20
42 / 100
1094 ms1476 KiB
#include "game.h" #include <algorithm> #include <vector> using namespace std; namespace solution_ns { int n; vector<vector<int>> G; void dfs(int u, vector<int> &was) { if (was[u]) return; was[u] = 1; for (int v = 0; v < n; v++) if (G[u][v]) dfs(v, was); } }; // namespace solution_ns void initialize(int n) { using namespace solution_ns; solution_ns::n = n; G.assign(n, vector<int>(n, 1)); for (int i = 0; i < n; i++) G[i][i] = 0; } int hasEdge(int u, int v) { using namespace solution_ns; G[u][v] = G[v][u] = 0; vector<int> was(n); dfs(0, was); if (*min_element(was.begin(), was.end())) return 0; G[u][v] = G[v][u] = 1; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...