HDOJ 4751 Divide Groups
比赛的时候题意居然是反的,看了半天样例都看不懂 。。。。
Divide Groups
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 456 Accepted Submission(s): 172

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.
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.
3 0
1 0
1 2 0
#include <iostream>
#include <cstring> #include <cstdio> #include <queue> using namespace std; int guanxi[111][111],color[111]; Edge E[21000]; void Init() void Add_Edge(int u,int v) int main() |
* This source code was highlighted by YcdoiT. ( style: Codeblocks )
HDOJ 4751 Divide Groups的更多相关文章
- HDU 4751 Divide Groups (2013南京网络赛1004题,判断二分图)
Divide Groups Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- hdu 4751 Divide Groups(dfs染色 或 2-sat)
Problem Description This year is the 60th anniversary of NJUST, and to make the celebration more c ...
- HDU 4751 Divide Groups 2013 ACM/ICPC Asia Regional Nanjing Online
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4751 题目大意:判断一堆人能否分成两组,组内人都互相认识. 解题思路:如果两个人不是相互认识,该两人之 ...
- HDU 4751 Divide Groups
题目链接 比赛时候,建图建错了.大体算法想到了,不过很多细节都没想好. #include <cstdio> #include <cstring> #include <cm ...
- hdu 4751 Divide Groups bfs (2013 ACM/ICPC Asia Regional Nanjing Online 1004)
SDUST的训练赛 当时死磕这个水题3个小时,也无心去搞其他的 按照题意,转换成无向图,预处理去掉单向的边,然后判断剩下的图能否构成两个无向完全图(ps一个完全图也行或是一个完全图+一个孤点) 代码是 ...
- HDU 4751 Divide Groups (2-SAT)
题意 给定一个有向图,问是否能够分成两个有向完全图. 思路 裸的2-sat--我们设一个完全图为0,另一个完全图为1,对于一个点对(u, v),如果u.v不是双向连通则它们两个不能在一组,即u和v至少 ...
- Divide Groups 二分图的判定
Divide Groups Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- hdu4751 Divide Groups
This year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is goi ...
- HDU-4751 Divide Groups 染色问题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4751 题意:有n个人,每个人都认识一些人,要求把他们分成两个集合,使得两个集合中的人都相符两两认识. ...
随机推荐
- [iOS Keychain本地长期键值存储]
目前本地存储方式大致有:Sqlite,Coredata,NSUserdefaults.但他们都是在删除APP后就会被删除,如果长期使用存储,可以使用Keychain钥匙串来实现. CHKeychain ...
- Centos下 为Firefox安装Flash插件
方法一: 直接到官网去下载RPM格式的安装包,下载好后直接 用 rpm -ivh XXXX.rpm 来安装即可. 方法二: 到官网下载tar.gz格式的,自己配置安装: #wget http://fp ...
- django写的留言板
代码见 https://github.com/linux-wang/show-me-the-code/tree/master/dj_test 实际上是 https://github.com/linux ...
- mysql 生成排名字段
假设有test表,下图为表机构和数据,score表示积分.现在要查询积分排名为第几的id?? 查询语句 select id,score,(@rowno:=@rowno+1) as rowno from ...
- w3m浏览器 for Linux
w3m是个开放源代码的文字式网页浏览器. w3m支持表格.框架.SSL连线.颜色. 如果是在适当的terminal(内核支持framebuffer)上,甚至还能显示图片. 这个软件通常尽量呈现出网页本 ...
- 9.19 JS数组
数组:相同类型数据的集合强类型语言:1数组里面只能存放相同数据类型的数据 2定义数组的时候需要制定一个长度(可以存放的元素数量) 3内存空间连续集合:1.可以存放任意类型的数据 ...
- matlab连接sql数据库
最近项目还涉及到matlab连接数据库,下面我就记录如何进行配置使得matlab能够连接sql数据库.由于最近工程做的多一些,所以分享的都在工程配置上,当初为了这些配置可是反复卸载与重装,算法其实也有 ...
- 微软.NET序列化格式
官方文档 https://msdn.microsoft.com/en-us/library/cc236844.aspx 对比 http://www.codeproject.com/Articles/3 ...
- ecshop程序结构说明
文件夹说明 名称 备注(作用或意义) 根目录 前台程序文件 admin 后台程序文件 admin/help 功能的帮助文件 admin/images 后台页面用图片 admin/includes 后台 ...
- js blind使用
$("#music_up").bind("click",showData()); $("#music_up").bind("cli ...