Submission #1076955

#TimeUsernameProblemLanguageResultExecution timeMemory
1076955ArthuroWichParachute rings (IOI12_rings)C++17
0 / 100
4029 ms10328 KiB
#include<bits/stdc++.h> using namespace std; vector<int> adj[200005], vis; int n, ans = 0; bool f = 1; void Init(int N_) { n = N_; ans = n; } void dfs(int i, int p, int s) { if (vis[i]) { f = 0; return; } vis[i] = 1; for (int j : adj[i]) { if (j == p || j == s) { continue; } dfs(j, i, s); } } int calc(int a) { vis.resize(n, 0); f = 1; for (int i = 0; i < n; i++) { if (i != a && adj[i].size()-count(adj[i].begin(), adj[i].end(), a) > 2) { f = 0; break; } if (vis[i] || i == a) { continue; } dfs(i, -1, a); } vis.clear(); return f; } void Link(int A, int B) { adj[A].push_back(B); adj[B].push_back(A); ans = 0; for (int i = 0; i < n; i++) { ans += calc(i); } } int CountCritical() { return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...