#include <bits/stdc++.h>
//#include "rings.h"
using namespace std;
const int N = 5e3 + 5;
int n;
vector<int> v[N];
bool vis[N], ok;
int deg[N], nod;
void dfs(int s, int p) {
vis[s] = 1;
if(deg[s] > 2) ok = false;
for(auto i : v[s]) {
if(i != p && i != nod) {
if(vis[i] == 0) {
dfs(i,s);
}
else {
ok = false;
}
}
}
}
void Init(int N_) {
n = N_;
}
void Link(int A, int B) {
deg[A]++; deg[B]++;
v[A].push_back(B);
v[B].push_back(A);
}
int CountCritical() {
int sol = 0;
for(int i = 0; i < n; i++) {
nod = i; ok = true;
for(auto j : v[i]) deg[j]--;
for(int j = 0; j < n; j++) vis[j] = 0;
for(int j = 0; j < n; j++) {
if(vis[j] == 0 && j != nod) {
dfs(j,-1);
}
}
if(ok) sol++;
for(auto j : v[i]) deg[j]++;
}
return sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
192 ms |
768 KB |
Output is correct |
3 |
Correct |
325 ms |
600 KB |
Output is correct |
4 |
Correct |
10 ms |
600 KB |
Output is correct |
5 |
Correct |
107 ms |
764 KB |
Output is correct |
6 |
Correct |
401 ms |
856 KB |
Output is correct |
7 |
Correct |
105 ms |
600 KB |
Output is correct |
8 |
Correct |
189 ms |
756 KB |
Output is correct |
9 |
Correct |
350 ms |
860 KB |
Output is correct |
10 |
Correct |
346 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
192 ms |
768 KB |
Output is correct |
3 |
Correct |
325 ms |
600 KB |
Output is correct |
4 |
Correct |
10 ms |
600 KB |
Output is correct |
5 |
Correct |
107 ms |
764 KB |
Output is correct |
6 |
Correct |
401 ms |
856 KB |
Output is correct |
7 |
Correct |
105 ms |
600 KB |
Output is correct |
8 |
Correct |
189 ms |
756 KB |
Output is correct |
9 |
Correct |
350 ms |
860 KB |
Output is correct |
10 |
Correct |
346 ms |
604 KB |
Output is correct |
11 |
Execution timed out |
4019 ms |
600 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
192 ms |
768 KB |
Output is correct |
3 |
Correct |
325 ms |
600 KB |
Output is correct |
4 |
Correct |
10 ms |
600 KB |
Output is correct |
5 |
Correct |
107 ms |
764 KB |
Output is correct |
6 |
Correct |
401 ms |
856 KB |
Output is correct |
7 |
Correct |
105 ms |
600 KB |
Output is correct |
8 |
Correct |
189 ms |
756 KB |
Output is correct |
9 |
Correct |
350 ms |
860 KB |
Output is correct |
10 |
Correct |
346 ms |
604 KB |
Output is correct |
11 |
Execution timed out |
4019 ms |
600 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
192 ms |
768 KB |
Output is correct |
3 |
Correct |
325 ms |
600 KB |
Output is correct |
4 |
Correct |
10 ms |
600 KB |
Output is correct |
5 |
Correct |
107 ms |
764 KB |
Output is correct |
6 |
Correct |
401 ms |
856 KB |
Output is correct |
7 |
Correct |
105 ms |
600 KB |
Output is correct |
8 |
Correct |
189 ms |
756 KB |
Output is correct |
9 |
Correct |
350 ms |
860 KB |
Output is correct |
10 |
Correct |
346 ms |
604 KB |
Output is correct |
11 |
Runtime error |
1 ms |
856 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |