博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Codeforces 862B - Mahmoud and Ehab and the bipartiteness
阅读量:6984 次
发布时间:2019-06-27

本文共 586 字,大约阅读时间需要 1 分钟。

思路:先染色,然后找一种颜色dfs遍历每一个点求答案。

代码:

#include
using namespace std;#define ll long long#define pb push_back#define mem(a,b) memset(a,b,sizeof(a))const int N=1e6+5;bool color[N]; vector
g[N];int c=0;int n;ll ans=0;void dfs(int u,int v){ color[v]=!color[u]; if(color[v]==true)c++; for(int i=0;i
>n; for(int i=0;i
>u>>v; g[u].pb(v); g[v].pb(u); } color[0]=false; dfs(0,1); DFS(0,1); cout<
<

 

转载于:https://www.cnblogs.com/widsom/p/7569445.html

你可能感兴趣的文章
phonegap+jquerymobile开发android的心得(4)
查看>>
js获取url传递参数
查看>>
jQuery中bind方法与live方法区别
查看>>
高德地图POI查找
查看>>
磁盘格式化
查看>>
Fedora 11 安装指南-12
查看>>
iOS中的一些小知识点
查看>>
Oracle 11g RAC 添加新节点及故障解决案例
查看>>
docker logstash 使用
查看>>
Linux Study之--RedHat EL6配置VNC server
查看>>
负载均衡集群之lvs
查看>>
(三) Graphivz 基本图片类型
查看>>
ubuntu 升级过程中断电时遇到的问题总汇
查看>>
Netscaler基于policy的log action
查看>>
删除sql server 表中的重复数据!
查看>>
水仙花数
查看>>
初识set集合
查看>>
怎么寻回调整分区后盘符丢失的数据
查看>>
警惕!MySQL成数据勒索新目标
查看>>
linux系统学习第一天
查看>>