Submission #718739

#TimeUsernameProblemLanguageResultExecution timeMemory
718739mseebacherGame (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]; int hasCycle(int x,int p, int start){ if(x == start && p != -1){ return 1; } for(auto s: ad[x]){ if(s == p) continue; return hasCycle(s,x,start); } return 0; } void initialize(int n) { a.assign(n+1,n-1); } int hasEdge(int u, int v) { a[u]--; a[v]--; if(a[u] == 0 || a[v] == 0){ return 1; } ad[u].push_back(v); ad[v].push_back(u); int x = hasCycle(u,-1,u); if(x){ ad[u].erase(find(ad[u].begin(),ad[u].end(),v)); ad[v].erase(find(ad[v].begin(),ad[v].end(),u)); } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...