#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for (int i=0; i<(n); i++)
#define pb push_back
using namespace std;
int N;
vector<int> G[5000];
int cnt[5000];
void Init(int N_) {
N = N_;
cnt[0] = N;
if (N > 5000) abort();
}
void Link(int A, int B) {
cnt[G[A].size()]--;
cnt[G[B].size()]--;
G[A].pb(B);
G[B].pb(A);
cnt[G[A].size()]++;
cnt[G[B].size()]++;
}
bool has_cycle;
bool used[5000];
void dfs(int x, int p, int except) {
used[x] = true;
for (int t : G[x]) if (t != p && t != except) {
if (used[t]) { has_cycle = true; break; }
dfs(t, x, except);
}
}
int CountCritical() {
int ctr = 0;
rep(i, N) {
rep(j, N) used[j] = false;
has_cycle = false;
rep(j, N) if (i != j && !used[j]) dfs(j, -1, i);
if (has_cycle) continue;
for (int t : G[i]) {
cnt[G[t].size()]--;
cnt[G[t].size()-1]++;
}
cnt[G[i].size()]--;
if (cnt[0]+cnt[1]+cnt[2] == N-1) ctr++;
cnt[G[i].size()]++;
for (int t : G[i]) {
cnt[G[t].size()-1]--;
cnt[G[t].size()]++;
}
}
return ctr;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
488 ms |
696 KB |
Output is correct |
3 |
Correct |
891 ms |
792 KB |
Output is correct |
4 |
Correct |
16 ms |
792 KB |
Output is correct |
5 |
Correct |
234 ms |
812 KB |
Output is correct |
6 |
Correct |
1050 ms |
968 KB |
Output is correct |
7 |
Correct |
166 ms |
968 KB |
Output is correct |
8 |
Correct |
399 ms |
968 KB |
Output is correct |
9 |
Correct |
929 ms |
968 KB |
Output is correct |
10 |
Correct |
858 ms |
968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
1084 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
488 ms |
696 KB |
Output is correct |
3 |
Correct |
891 ms |
792 KB |
Output is correct |
4 |
Correct |
16 ms |
792 KB |
Output is correct |
5 |
Correct |
234 ms |
812 KB |
Output is correct |
6 |
Correct |
1050 ms |
968 KB |
Output is correct |
7 |
Correct |
166 ms |
968 KB |
Output is correct |
8 |
Correct |
399 ms |
968 KB |
Output is correct |
9 |
Correct |
929 ms |
968 KB |
Output is correct |
10 |
Correct |
858 ms |
968 KB |
Output is correct |
11 |
Execution timed out |
4027 ms |
1228 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
488 ms |
696 KB |
Output is correct |
3 |
Correct |
891 ms |
792 KB |
Output is correct |
4 |
Correct |
16 ms |
792 KB |
Output is correct |
5 |
Correct |
234 ms |
812 KB |
Output is correct |
6 |
Correct |
1050 ms |
968 KB |
Output is correct |
7 |
Correct |
166 ms |
968 KB |
Output is correct |
8 |
Correct |
399 ms |
968 KB |
Output is correct |
9 |
Correct |
929 ms |
968 KB |
Output is correct |
10 |
Correct |
858 ms |
968 KB |
Output is correct |
11 |
Execution timed out |
4027 ms |
1228 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
488 ms |
696 KB |
Output is correct |
3 |
Correct |
891 ms |
792 KB |
Output is correct |
4 |
Correct |
16 ms |
792 KB |
Output is correct |
5 |
Correct |
234 ms |
812 KB |
Output is correct |
6 |
Correct |
1050 ms |
968 KB |
Output is correct |
7 |
Correct |
166 ms |
968 KB |
Output is correct |
8 |
Correct |
399 ms |
968 KB |
Output is correct |
9 |
Correct |
929 ms |
968 KB |
Output is correct |
10 |
Correct |
858 ms |
968 KB |
Output is correct |
11 |
Runtime error |
3 ms |
1084 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |