Submission #779183

#TimeUsernameProblemLanguageResultExecution timeMemory
779183Sohsoh84Game (IOI14_game)C++17
42 / 100
1081 ms26028 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(),(x).end() const int MAXN = 1e6 + 10; int n; vector<int> adj[MAXN]; bool vis[MAXN]; void initialize(int n_) { n = n_; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (i != j) adj[i].push_back(j); } void dfs(int v) { vis[v] = true; for (int u : adj[v]) if (!vis[u]) dfs(u); } int hasEdge(int u, int v) { adj[u].erase(find(all(adj[u]), v)); adj[v].erase(find(all(adj[v]), u)); for (int i = 0; i < n; i++) vis[i] = false; dfs(1); bool flag = true; for (int i = 0; i < n; i++) if (!vis[i]) flag = false; if (flag) return 0; adj[u].push_back(v); adj[v].push_back(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...