#include<bits/stdc++.h>
using namespace std;
const int N = 5010;
int n;
vector<int> g[N];
vector<vector<int>> v(N, vector<int> (N,0));
void Init(int N_) {
n = N_;
}
void Link(int A, int B) {
if(v[A][B])return;
g[A].push_back(B);
g[B].push_back(A);
v[A][B]=1;
v[B][A]=1;
}
int cur;
bool check;
bool vis[N];
void dfs(int at, int p) {
if(vis[at])return;
vis[at]=1;
int cnt=0;
for(int to:g[at]) {
if(to == p or to == cur)continue;
if(vis[to]){
check=false;
return;
}
dfs(to,at);
cnt++;
}
if(cnt>1)check=false;
}
int CountCritical() {
int ans=0;
for(int j = 0;j<n;j++) {
cur=j;
check=1;
for(int i = 0;i<n;i++)vis[i]=0;
for(int i = 0;i<n;i++) {
if(i == j)continue;
int deg=0;
for(int j:g[i]) {
if(j!=cur)deg++;
}
if(deg==1){
dfs(i,-1);
}
}
ans+=check;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
98752 KB |
Output is correct |
2 |
Correct |
461 ms |
98972 KB |
Output is correct |
3 |
Correct |
720 ms |
99020 KB |
Output is correct |
4 |
Incorrect |
74 ms |
98840 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
170 ms |
200236 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
98752 KB |
Output is correct |
2 |
Correct |
461 ms |
98972 KB |
Output is correct |
3 |
Correct |
720 ms |
99020 KB |
Output is correct |
4 |
Incorrect |
74 ms |
98840 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
98752 KB |
Output is correct |
2 |
Correct |
461 ms |
98972 KB |
Output is correct |
3 |
Correct |
720 ms |
99020 KB |
Output is correct |
4 |
Incorrect |
74 ms |
98840 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
98752 KB |
Output is correct |
2 |
Correct |
461 ms |
98972 KB |
Output is correct |
3 |
Correct |
720 ms |
99020 KB |
Output is correct |
4 |
Incorrect |
74 ms |
98840 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |