URAL 1099 Work Scheduling

题目链接
There is a certain amount of night guards that are available to protect the local junkyard from possible junk robberies. These guards need to be scheduled in pairs so that each pair guards in a different night. The junkyard CEO ordered you to write a program which given the guards characteristics determines the maximum amount of scheduled guards (the rest will be fired). Please note that each guard can be scheduled with only one of his colleagues and no guard can work alone.

Input

The first line of the input contains one number N ≤ 222 which is a number of night guards. Unlimited number of lines consisting of unordered pairs ( i, j) follow, each such pair means that guard # i and guard # j can work together, because it is possible to find uniforms that suit both of them (The junkyard uses different parts of uniforms for different guards i.e. helmets, pants, jackets. It is impossible to put small helmet on a guard with a big head or big shoes on guard with small feet). The input ends with Eof.

Output

You should output one possible optimal assignment. On the first line of the output write the even number C, the amount of scheduled guards. Then output C/2 lines, each containing 2 integers ( i, j) that denote that i and j will work together.

Example

input

3
1 2
2 3
1 3

output

2
1 2

这题就典型的一般图最大匹配,套一个带花树算法的模板即可,比较迷的是我上网找了一些板子改了总是不对……,可见网上的代码水分非常大,我建议如果样例测了不对就赶紧找下一个模板,这样节省时间

URAL 1099 Work Scheduling相关推荐

  1. URAL - 1099 Work Scheduling(一般图最大匹配-带花树模板)

    题目链接:点击查看 题目大意:给出n个警卫,接下来给出数个关系,表示两个警卫可以互相配合,现在规定只有可以互相配合的警卫才能留下来继续工作,问最多能有多少个警卫留下来工作,输出匹配方案 题目分析:一般 ...

  2. kuangbin带你飞专题合集

    题目列表 [kuangbin带你飞]专题一 简单搜索 [kuangbin带你飞]专题二 搜索进阶 [kuangbin带你飞]专题三 Dancing Links [kuangbin带你飞]专题四 最短路 ...

  3. 算法学习经典例题整理

    陆续会对本篇博客进行更新! 搜索:https://vjudge.net/contest/292597 区间DP:https://vjudge.net/contest/293892 树状背包:https ...

  4. kuangbin带你飞 专题1-23 题单

    kuangbin大神,对于打过ACM比赛的ACMer,无人不知无人不晓. 在此,附上vjudge平台上一位大神整理的[kuangbin带你飞]专题目录链接. [kuangbin带你飞专题目录1-23] ...

  5. 老鱼的-kuangbin专题题解

    kuangbin专题问题一览 专题一 简单搜索 POJ 1321 棋盘问题 POJ 2251 Dungeon Master POJ 3278 Catch That Cow POJ 3279 Flipt ...

  6. pku,zju题目分类

    哎呦喂,直接ctrl+A了.话说浙江大学的题还见过的呢.. 公告: [意见反馈][官方博客]   ural pku Zju 题目分类 收藏   感谢 mugu 的提供.... Ural Problem ...

  7. 『kuangbin带你飞』专题10:匹配问题

    目录 1. Fire Net HDU - 1045 (搜索 or 匹配) 2. The Accomodation of Students HDU - 2444(二分图判断) 3. Courses HD ...

  8. [kuangbin]各种各样的题单

    [kuangbin]各种各样的题单 专题1 简单搜索 POJ 1321 POJ 2251 POJ 3278 POJ 3279 POJ 1426 POJ 3126 POJ 3087 POJ 3414 F ...

  9. [转]带花树,Edmonds's matching algorithm,一般图最大匹配

    看了两篇博客,觉得写得不错,便收藏之.. 首先是第一篇,转自某Final牛 带花树--其实这个算法很容易理解,但是实现起来非常奇葩(至少对我而言). 除了wiki和amber的程序我找到的资料看着都不 ...

  10. 一般图的匹配题集【from夏天的风】

    最大匹配(带花树) URAL 1099 ZOJ3316 Game HDU3446/TOJ 3557 daizhenyang's chess HDU3551 hard problem 最大权匹配(求解中 ...

最新文章

  1. quick cocos2d x 手机(Android端)启动过程学习
  2. cocos2d-x 2.x版本使用uiwidget需要注意的几点
  3. clodeblocks debug断点调试_Intellij IDEA高阶DEBUG大杀器
  4. 奔图内部扫描错误13_现代浏览器内部揭秘(第三部分)
  5. php 扩展apc 参数优化
  6. 2021 程序媛跳槽记:学习计划篇(已收获字节等offer)
  7. vscode输入vue自动_使用vscode,新建.vue文件,tab自动生成vue代码模板
  8. linux 7修改主机名重启后不生效_Linux 中改变主机名的 4 种方法 | Linux 中国
  9. 腾讯云加入LoRa联盟成为发起成员,加速推动物联网到智联网的进化
  10. Python 语言程序设计(3-2)time 库的使用
  11. python实现Longest Common Subsequence最长公共子序列算法
  12. 使用定位技术,边界判断要谨慎
  13. 如何设置网件gs108e_NETGEAR 美国网件 GS108E 交换机 开箱及单线复用教程
  14. 【AR】DroidCam笔记本调用手机摄像头(smartphone's camera as pc webcam)
  15. Django菜鸟入门
  16. 1.21 同级比较 倒装句 否定Neither
  17. 苹果电脑如何正确断网 Mac电脑断网方法
  18. 关于如何免费下载专利、英文文献等?
  19. 景元利老师--沪师经纪
  20. 元宇宙,小荷才露尖尖角

热门文章

  1. 摩拜与ofo, 你们这是为了共享单车还是共享经济?
  2. 定理证明器HOL的下载和安装
  3. HDMI转VGA转换器 HDMI转接头,VGA转换器
  4. Intel开发手册下载地址
  5. istio系列:第六章-Telemetry遥测配置
  6. 企业微信之发送应用消息案例
  7. amazon aws 亚马逊云服务概述
  8. 滚滚长江东逝水历史的天空
  9. vue3+tsx封装组件
  10. 使用快解析一招解决电脑dns异常问题