A. 电压机制
题目可以迅速转化为:删掉一条边使得图变为一个二分图.
然而这并没有什么用..
另外可以发现我们必须删掉一条边,这条边满足是所有奇环的公共边,而且不能是偶环的边.
所以可以考虑差分实现.
A_code
#include<bits/stdc++.h>
using namespace std;
namespace BSS {
#define ll long long int
#define ull unsigned ll
#define lf double
#define lbt(x) (x&(-x))
#define mp(x,y) make_pair(x,y)
#define lb lower_bound
#define ub upper_bound
#define Fill(x,y) memset(x,y,sizeof x)
#define Copy(x,y) memcpy(x,y,sizeof x)
#define File(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
inline ll read() {
ll res=0; bool cit=1; char ch;
while(!isdigit(ch=getchar())) if(ch=='-') cit=0;
while(isdigit(ch)) res=(res<<3)+(res<<1)+(ch^48),ch=getchar();
return cit?res:-res;
}
} using namespace BSS;
const ll N=5e5+21;
ll m,n,ans,ts=1,cnt,alls;
ll head[N],odd[N],cf[N],dep[N];
struct I { ll u,v,nxt,vis; } e[N<<2];
inline void add(ll u,ll v){
e[++ts].u=u,e[ts].v=v,e[ts].nxt=head[u],
head[u]=ts;
}
void dfs(ll u,ll depth){
dep[u]=depth;
for(int i=head[u];i;i=e[i].nxt){
if(e[i].vis) continue;
e[i].vis=1,e[i^1].vis=1;
if(dep[e[i].v]){
ll len=dep[u]-dep[e[i].v]+1;
if(len&1){
odd[i]++,odd[i^1]++;
cf[e[i].v]--; alls++;
}
else{
odd[i]--,odd[i^1]--;
cf[e[i].v]++;
}
cf[u]+=odd[i];
}
else{
dfs(e[i].v,depth+1);
odd[i]+=cf[e[i].v],odd[i^1]+=cf[e[i].v];
cf[u]+=cf[e[i].v];
}
}
}
signed main(){
File(a);
n=read(),m=read(); ll u,v;
for(int i=1;i<=m;i++){
u=read(),v=read();
add(u,v),add(v,u);
}
dfs(1,1);
for(int i=2;i<=ts;i+=2) ans+=(odd[i]==alls);
printf("%lld\n",ans),exit(0);
}