Submission #136160

#TimeUsernameProblemLanguageResultExecution timeMemory
136160zoooma13Game (IOI14_game)C++14
42 / 100
1063 ms13020 KiB
#include "bits/stdc++.h" #include "game.h" using namespace std; #define MAX_N 1503 int n; set <int> adj[MAX_N]; void initialize(int N) { n = N; for(int u=0; u<n; u++) for(int v=u+1; v<n; v++){ adj[u].insert(v); adj[v].insert(u); } } int conn = 0; bool vis[MAX_N]; void dfs(int u){ vis[u] = 1; conn++; for(auto&v : adj[u]) if(!vis[v]) dfs(v); } int hasEdge(int u, int v) { adj[u].erase(v); adj[v].erase(u); memset(vis ,0 ,sizeof vis); conn = 0; dfs(u); if(conn == n) return 0; adj[u].insert(v); adj[v].insert(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...