#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
8 ms |
708 KB |
Output is correct |
3 |
Correct |
14 ms |
808 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4006 ms |
30932 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
8 ms |
708 KB |
Output is correct |
3 |
Correct |
14 ms |
808 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
8 ms |
708 KB |
Output is correct |
3 |
Correct |
14 ms |
808 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
8 ms |
708 KB |
Output is correct |
3 |
Correct |
14 ms |
808 KB |
Output is correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |