#include <bits/stdc++.h>
using namespace std;
const int M = 1e6;
int n;
vector<int> adj[M];
bool v[M], ok;
void dfs(int node, int forb) {
if (!v[node]) {
v[node] = 1;
int cnt = 0;
for (int x : adj[node])
if (x != forb)
cnt++;
if (cnt > 2) {
ok = false;
return;
}
for (int x : adj[node])
if (x != forb)
dfs(x, forb);
}
}
void Init(int N) { n = N; }
void Link(int a, int b) {
adj[a].push_back(b);
adj[b].push_back(a);
}
int CountCritical() {
int ans = 0;
for (int i = 0; i < n; i++) {
memset(v, 0, sizeof v);
ok = true;
for (int j = 0; j < n; j++)
if (!v[j] && i != j)
dfs(j, i);
ans += ok;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
24832 KB |
Output is correct |
2 |
Correct |
696 ms |
25080 KB |
Output is correct |
3 |
Correct |
1006 ms |
25080 KB |
Output is correct |
4 |
Incorrect |
84 ms |
24832 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4013 ms |
41120 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
24832 KB |
Output is correct |
2 |
Correct |
696 ms |
25080 KB |
Output is correct |
3 |
Correct |
1006 ms |
25080 KB |
Output is correct |
4 |
Incorrect |
84 ms |
24832 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
24832 KB |
Output is correct |
2 |
Correct |
696 ms |
25080 KB |
Output is correct |
3 |
Correct |
1006 ms |
25080 KB |
Output is correct |
4 |
Incorrect |
84 ms |
24832 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
24832 KB |
Output is correct |
2 |
Correct |
696 ms |
25080 KB |
Output is correct |
3 |
Correct |
1006 ms |
25080 KB |
Output is correct |
4 |
Incorrect |
84 ms |
24832 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |