#include <bits/stdc++.h>
//#include "rings.h"
using namespace std;
const int N = 1e6 + 5;
int n;
int cnt = 0;
vector<int> v[N];
int deg[N];
void Init(int N_) {
n = N_;
}
void Link(int A, int B) {
deg[A]++; deg[B]++;
if(deg[A] > 2) cnt++;
if(deg[B] > 2) cnt++;
v[A].push_back(B);
v[B].push_back(A);
}
int CountCritical() {
int sol = 0;
for(int i = 1; i <= n; i++) {
int cur = cnt;
if(deg[i] > 2) cur--;
for(auto j : v[i]) {
if(deg[j] == 3) cur--;
}
if(cur == 0) sol++;
}
return sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
25432 KB |
Output is correct |
2 |
Incorrect |
5 ms |
25648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
152 ms |
50972 KB |
Output is correct |
2 |
Incorrect |
303 ms |
63344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
25432 KB |
Output is correct |
2 |
Incorrect |
5 ms |
25648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
25432 KB |
Output is correct |
2 |
Incorrect |
5 ms |
25648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
25432 KB |
Output is correct |
2 |
Incorrect |
5 ms |
25648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |