#include <bits/stdc++.h>
using namespace std;
const int mxN = 1000005;
vector<int> adj[mxN];
int neib[mxN], n;
void Init(int size) {
n = size;
}
void Link(int a, int b) {
adj[a].push_back(b);
adj[b].push_back(a);
neib[a]++, neib[b]++;
}
int CountCritical() {
int ans = 0;
for(int i = 0; i < n; i++) {
for(auto &v : adj[i])
neib[v]--;
bool ok = true;
for(int j = 0; j < n; j++) {
if(i == j) continue;
if(neib[j] > 2) {
ok = false;
break;
}
}
for(auto &v : adj[i])
neib[v]++;
if(ok)
ans++;
}
return ans;
}
/*
int main() {
scanf("%d", &n);
Init(n);
int q;
scanf("%d", &q);
while(q--) {
int type, a, b;
scanf("%d", &type);
if(type == 1) {
scanf("%d %d", &a, &b);
Link(a, b);
} else
printf("%d\n", CountCritical());
}
return 0;
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
23756 KB |
Output is correct |
2 |
Correct |
30 ms |
23968 KB |
Output is correct |
3 |
Correct |
22 ms |
23976 KB |
Output is correct |
4 |
Incorrect |
17 ms |
23756 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4041 ms |
42112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
23756 KB |
Output is correct |
2 |
Correct |
30 ms |
23968 KB |
Output is correct |
3 |
Correct |
22 ms |
23976 KB |
Output is correct |
4 |
Incorrect |
17 ms |
23756 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
23756 KB |
Output is correct |
2 |
Correct |
30 ms |
23968 KB |
Output is correct |
3 |
Correct |
22 ms |
23976 KB |
Output is correct |
4 |
Incorrect |
17 ms |
23756 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
23756 KB |
Output is correct |
2 |
Correct |
30 ms |
23968 KB |
Output is correct |
3 |
Correct |
22 ms |
23976 KB |
Output is correct |
4 |
Incorrect |
17 ms |
23756 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |