This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <vector>
using namespace std;
vector<vector<int>> adj;
vector<int> degree;
int n;
void Init(int N_) {
n = N_;
adj.resize(n, vector<int>{});
degree.resize(n, 0);
}
void Link(int u, int v) {
adj[u].push_back(v);
adj[v].push_back(u);
degree[u]++, degree[v]++;
}
int CountCritical() {
int cnt = 0;
for (int u = 0; u < n; u++) {
// trying to remove node u
for (int v : adj[u]) {
degree[v]--;
}
bool isCritical = true;
for (int v = 0; v < n; v++) {
if (v == u) continue;
isCritical &= degree[v] <= 2;
}
cnt += isCritical;
for (int v : adj[u]) {
degree[v]++;
}
}
return cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |