博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Divide Groups 二分图的判定
阅读量:6232 次
发布时间:2019-06-21

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

Divide Groups

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 1835    Accepted Submission(s): 657

Problem Description
  This year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is going to invite distinguished alumnus back to visit and take photos.
  After carefully planning, Tom200 announced his activity plan, one that contains two characters:
  1. Whether the effect of the event are good or bad has nothing to do with the number of people join in.
  
2. The more people joining in one activity know each other, the more interesting the activity will be. Therefore, the best state is that, everyone knows each other.
  The event appeals to a great number of alumnus, and Tom200 finds that they may not know each other or may just unilaterally recognize others. To improve the activities effects, Tom200 has to divide all those who signed up into groups to take part in the activity at different time. As we know, one's energy is limited, and Tom200 can hold activity twice. Tom200 already knows the relationship of each two person, but he cannot divide them because the number is too large.
  Now Tom200 turns to you for help. Given the information, can you tell if it is possible to complete the dividing mission to make the two activity in best state.
 

 

Input
  The input contains several test cases, terminated by EOF.
  Each case starts with a positive integer n (2<=n<=100), which means the number of people joining in the event.
  N lines follow. The i-th line contains some integers which are the id
of students that the i-th student knows, terminated by 0. And the id starts from 1.
 

 

Output
  If divided successfully, please output "YES" in a line, else output "NO".
 

 

Sample Input
3 3 0 1 0 1 2 0
 

 

Sample Output
YES
 
#include 
#include
#include
#include
#include
using namespace std;const int Max=111;int G[Max][Max];int path[Max][Max],book[Max],color[Max],book1[Max];int n;bool dfs(int u,int co){// cout<
<<" "<
<<" "<
<

 

 

转载于:https://www.cnblogs.com/zsyacm666666/p/5299477.html

你可能感兴趣的文章
Flake8学习
查看>>
SpringBoot项目eclipse运行正常maven install打包启动后报错ClassNotFoundException
查看>>
ASP.NET Core的身份认证框架IdentityServer4(9)-使用OpenID Connect添加用户认证
查看>>
[Python] String Formatting
查看>>
lapis 处理接收到的json 数据
查看>>
【spring boot logback】日志使用自定义的logback-spring.xml文件后,application.properties中关于日志的相关配置还会起作用么...
查看>>
Ad Hoc Distributed Queries的启用与关闭
查看>>
java工具类POI导出word
查看>>
openwrt使用list
查看>>
shell语言
查看>>
C++动态分配内存
查看>>
Android Studio工程Gradle编译报错
查看>>
桌面小部件开发
查看>>
Unity3d dll 热更新 基础框架
查看>>
spring boot整合mybatis+mybatis-plus
查看>>
深度学习利器:TensorFlow在智能终端中的应用——智能边缘计算,云端生成模型给移动端下载,然后用该模型进行预测...
查看>>
如何查看表和索引的统计信息
查看>>
word文档的动态添加数据
查看>>
模仿ReentrantLock类自定义锁
查看>>
Redis进阶实践之九 独立封装的RedisClient客户端工具类
查看>>