This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |