#include <bits/stdc++.h>
using namespace std;
int N;
const int cn = 10000;
vector<int> adj[cn];
int deg[cn];
int vis[cn];
int c;
bool bd = 1;
int del;
void dfs(int x, int p)
{
vis[x] = c;
int ch = (p != x);
for (auto u : adj[x])
{
if (u == p || del == u)
continue;
if (vis[u] == c)
bd = 0;
else
dfs(u, x), ++ch;
}
if (ch > 2)
bd = 0;
}
int brute()
{
++c;
set<int> cri;
for (int i = 0; i < N; ++i)
{
del = i;
for (auto u : adj[i])
{
deg[u]--;
deg[i]--;
}
bool ok = 1;
for (int j = 0; j < N; ++j)
{
++ c ;
if (vis[j] != c && i != j)
{
bd = 1;
dfs(j, j);
ok &= bd;
}
}
if (ok)
cri.insert(i);
for (auto u : adj[i])
{
deg[u]++;
deg[i]++;
}
}
return (int)cri.size();
}
void Init(int N_)
{
N = N_;
}
void Link(int A, int B)
{
adj[A].push_back(B);
adj[B].push_back(A);
deg[A]++;
deg[B]++;
}
int CountCritical()
{
return brute();
return N;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Execution timed out |
4011 ms |
768 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Execution timed out |
4011 ms |
768 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Execution timed out |
4011 ms |
768 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Execution timed out |
4011 ms |
768 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |