# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119200 | 2019-06-20T16:14:19 Z | ioilolcom | Parachute rings (IOI12_rings) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define endl "\n" typedef long long int ll; int N; const int M=1e6+7; set<int> adj[M]; int deg[M]; void Init(int N_) { N = N_; } void Link(int A, int B) { adj[A].insert(B); adj[B].insert(A); deg[A]++; deg[B]++; } bool is(int x){ for(int v:adj[x]) { deg[v]--; } for(int v=0; v<N; v++) { if(v==x) { continue; } if(deg[v]>2) { return 0; } } for(int v:adj[x]) { deg[v]++; } return 1; } int CountCritical() { int ans=0; ans+=is(x); return ans; }