#include <bits/stdc++.h>
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
const int NN = 1e6+12,INF=1e9+7;
vector <int> g[NN];
int N,M,vis[NN],ans;
void dfs(int x,int p){
vis[x] = 1;
bool f=0;
for (int to: g[x]){
if (to == p || vis[to] == 2 || ans==0)continue;
if (vis[to] == 1)ans=0;
if (vis[to] == 0 && f==1 && p != -1)ans=0;
if (vis[to] == 0){
dfs(to,x);
f=1;
}
}
}
void Init(int N_){
N=N_;
}
void Link(int A, int B) {
g[A].pb(B);
g[B].pb(A);
}
int CountCritical() {
int res = 0,i,j;
for (i=0;i<N;++i){
vis[i] = 2;
ans=1;
for (j=0;j<N;++j){
if (vis[j] == 0 && ans){
dfs(j,-1);
}
}
for (j=0;j<N;++j)vis[j] = 0;
res+=ans;
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
23788 KB |
Output is correct |
2 |
Correct |
183 ms |
24192 KB |
Output is correct |
3 |
Correct |
113 ms |
24044 KB |
Output is correct |
4 |
Correct |
27 ms |
23916 KB |
Output is correct |
5 |
Correct |
200 ms |
24044 KB |
Output is correct |
6 |
Correct |
732 ms |
24248 KB |
Output is correct |
7 |
Correct |
62 ms |
23916 KB |
Output is correct |
8 |
Correct |
145 ms |
24044 KB |
Output is correct |
9 |
Correct |
255 ms |
24044 KB |
Output is correct |
10 |
Correct |
203 ms |
24172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4035 ms |
49132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
23788 KB |
Output is correct |
2 |
Correct |
183 ms |
24192 KB |
Output is correct |
3 |
Correct |
113 ms |
24044 KB |
Output is correct |
4 |
Correct |
27 ms |
23916 KB |
Output is correct |
5 |
Correct |
200 ms |
24044 KB |
Output is correct |
6 |
Correct |
732 ms |
24248 KB |
Output is correct |
7 |
Correct |
62 ms |
23916 KB |
Output is correct |
8 |
Correct |
145 ms |
24044 KB |
Output is correct |
9 |
Correct |
255 ms |
24044 KB |
Output is correct |
10 |
Correct |
203 ms |
24172 KB |
Output is correct |
11 |
Execution timed out |
4059 ms |
24088 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
23788 KB |
Output is correct |
2 |
Correct |
183 ms |
24192 KB |
Output is correct |
3 |
Correct |
113 ms |
24044 KB |
Output is correct |
4 |
Correct |
27 ms |
23916 KB |
Output is correct |
5 |
Correct |
200 ms |
24044 KB |
Output is correct |
6 |
Correct |
732 ms |
24248 KB |
Output is correct |
7 |
Correct |
62 ms |
23916 KB |
Output is correct |
8 |
Correct |
145 ms |
24044 KB |
Output is correct |
9 |
Correct |
255 ms |
24044 KB |
Output is correct |
10 |
Correct |
203 ms |
24172 KB |
Output is correct |
11 |
Execution timed out |
4059 ms |
24088 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
23788 KB |
Output is correct |
2 |
Correct |
183 ms |
24192 KB |
Output is correct |
3 |
Correct |
113 ms |
24044 KB |
Output is correct |
4 |
Correct |
27 ms |
23916 KB |
Output is correct |
5 |
Correct |
200 ms |
24044 KB |
Output is correct |
6 |
Correct |
732 ms |
24248 KB |
Output is correct |
7 |
Correct |
62 ms |
23916 KB |
Output is correct |
8 |
Correct |
145 ms |
24044 KB |
Output is correct |
9 |
Correct |
255 ms |
24044 KB |
Output is correct |
10 |
Correct |
203 ms |
24172 KB |
Output is correct |
11 |
Execution timed out |
4035 ms |
49132 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |