Submission #718740

#TimeUsernameProblemLanguageResultExecution timeMemory
718740mseebacherGame (IOI14_game)C++17
0 / 100
1 ms340 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; vector<int> a; vector<int> ad[(int)2e3]; bool b = 0; void hasCycle(int x,int p, int start){ if(x == start && p != -1){ b = 1; return; } for(auto s: ad[x]){ if(s == p) continue; return hasCycle(s,x,start); } } void initialize(int n) { a.assign(n+1,n-1); } int hasEdge(int u, int v) { b = 0; a[u]--; a[v]--; if(a[u] == 0 || a[v] == 0){ return 1; } hasCycle(u,-1,u); ad[u].push_back(v); ad[v].push_back(u); if(b){ ad[u].erase(find(ad[u].begin(),ad[u].end(),v)); ad[v].erase(find(ad[v].begin(),ad[v].end(),u)); } return b; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...