#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;
vector<int> vec;
void dfs(int x, int p)
{
vis[x] = c;
int ch = (p != x);
vec.push_back(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()
{
set<int> cri;
for (int i = 0; i < N; ++i)
{
++ c ;
del = i;
for (auto u : adj[i])
{
deg[u]--;
deg[i]--;
}
bool ok = 1;
vec.clear();
for (int j = 0; j < N; ++j)
{
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 |
1 ms |
640 KB |
Output is correct |
2 |
Correct |
507 ms |
768 KB |
Output is correct |
3 |
Correct |
771 ms |
956 KB |
Output is correct |
4 |
Correct |
27 ms |
672 KB |
Output is correct |
5 |
Correct |
257 ms |
1052 KB |
Output is correct |
6 |
Correct |
830 ms |
1452 KB |
Output is correct |
7 |
Correct |
244 ms |
760 KB |
Output is correct |
8 |
Correct |
396 ms |
1016 KB |
Output is correct |
9 |
Correct |
783 ms |
1152 KB |
Output is correct |
10 |
Correct |
773 ms |
1100 KB |
Output is correct |
# |
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 |
1 ms |
640 KB |
Output is correct |
2 |
Correct |
507 ms |
768 KB |
Output is correct |
3 |
Correct |
771 ms |
956 KB |
Output is correct |
4 |
Correct |
27 ms |
672 KB |
Output is correct |
5 |
Correct |
257 ms |
1052 KB |
Output is correct |
6 |
Correct |
830 ms |
1452 KB |
Output is correct |
7 |
Correct |
244 ms |
760 KB |
Output is correct |
8 |
Correct |
396 ms |
1016 KB |
Output is correct |
9 |
Correct |
783 ms |
1152 KB |
Output is correct |
10 |
Correct |
773 ms |
1100 KB |
Output is correct |
11 |
Execution timed out |
4009 ms |
1284 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
640 KB |
Output is correct |
2 |
Correct |
507 ms |
768 KB |
Output is correct |
3 |
Correct |
771 ms |
956 KB |
Output is correct |
4 |
Correct |
27 ms |
672 KB |
Output is correct |
5 |
Correct |
257 ms |
1052 KB |
Output is correct |
6 |
Correct |
830 ms |
1452 KB |
Output is correct |
7 |
Correct |
244 ms |
760 KB |
Output is correct |
8 |
Correct |
396 ms |
1016 KB |
Output is correct |
9 |
Correct |
783 ms |
1152 KB |
Output is correct |
10 |
Correct |
773 ms |
1100 KB |
Output is correct |
11 |
Execution timed out |
4009 ms |
1284 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
640 KB |
Output is correct |
2 |
Correct |
507 ms |
768 KB |
Output is correct |
3 |
Correct |
771 ms |
956 KB |
Output is correct |
4 |
Correct |
27 ms |
672 KB |
Output is correct |
5 |
Correct |
257 ms |
1052 KB |
Output is correct |
6 |
Correct |
830 ms |
1452 KB |
Output is correct |
7 |
Correct |
244 ms |
760 KB |
Output is correct |
8 |
Correct |
396 ms |
1016 KB |
Output is correct |
9 |
Correct |
783 ms |
1152 KB |
Output is correct |
10 |
Correct |
773 ms |
1100 KB |
Output is correct |
11 |
Runtime error |
2 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |