제출 #718744

#제출 시각아이디문제언어결과실행 시간메모리
718744mseebacher게임 (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)); a[u]++; a[v]++; } return b; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...