Submission #1123118

#TimeUsernameProblemLanguageResultExecution timeMemory
1123118epicci23Game (IOI14_game)C++20
0 / 100
1 ms324 KiB
#include "bits/stdc++.h" #include "game.h" #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; const int N = 85; set<int> s[N]; int n,vis[N]; void initialize(int _n){ n=_n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==j) continue; s[i].insert(j); } } } void dfs(int c){ if(vis[c]) return; vis[c]=1; for(int x:s[c]){ if(!vis[x]) dfs(x); } } bool connected(){ int comp=0; memset(vis,0,sizeof(vis)); for(int i=1;i<=n;i++){ if(vis[i]) continue; comp++; dfs(i); } return comp == 1; } int hasEdge(int u, int v){ s[u].erase(v); s[v].erase(u); if(connected()) return 0; else{ s[u].insert(v); s[v].insert(u); return 1; } } /*void _(){ } int32_t main(){ cin.tie(0); ios::sync_with_stdio(0); int tc=1;//cin >> tc; while(tc--) _(); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...