Shooting Contest 射击比赛 [POJ1719] [CEOI1997] [一题多解]
Description(下有中文题意)
A volley of c shots is correct if exactly one white square is hit in each column and there is no row without white square being hit. Help the shooter to find a correct volley of hits if such a volley exists.
Example
Consider the following target:

Volley of hits at white squares in rows 2, 3, 1, 4 in consecutive columns 1, 2, 3, 4 is correct.
Write a program that: verifies whether any correct volley of hits exists and if so, finds one of them.
Input
The first line of each block contains two integers r and c separated by a single space, 2 <= r <= c <= 1000. These are the numbers of rows and columns, respectively. Each of the next c lines in the block contains two integers separated by a single space. The integers in the input line i + 1 in the block, 1 <= i <= c, are labels of rows with white squares in the i-th column.
Output
Sample Input
2
4 4
2 4
3 4
1 3
1 4
5 5
1 5
2 4
3 4
2 4
2 3
Sample Output
2 3 1 4
NO
Hint
R,C<=1000
给你一个r*c的矩阵,然后这个矩阵每一列有两个格子是白色的,然后你在每列上开一枪,可以打这列的任意的白色格子,问你打到的格子所在的行数是不是包括所有行了,如果包括所有行输出你在1-c列打抢的格子的行,当然这可以是不唯一的(此题为SPJ (Special Judge)),如果打不到就输出NO。
Solution
这道题的解题方法可谓是千姿百态
一、网络流

三、贪心
Shooting Contest 射击比赛 [POJ1719] [CEOI1997] [一题多解]的更多相关文章
- poj 1719 Shooting Contest
http://poj.org/problem?id=1719 Shooting Contest Time Limit: 1000MS Memory Limit: 10000K Total Subm ...
- PAT 1082. 射击比赛 (20)
本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y),请你编写程序找出冠军和菜鸟.我们假设靶心在原点(0,0). 输入 ...
- PAT 1082 射击比赛
https://pintia.cn/problem-sets/994805260223102976/problems/994805260990660608 本题目给出的射击比赛的规则非常简单,谁打的弹 ...
- POJ 1719 Shooting Contest(二分图匹配)
POJ 1719 Shooting Contest id=1719" target="_blank" style="">题目链接 题意:给定一个 ...
- PAT 1082 射击比赛(20)(代码+思路)
1082 射击比赛(20 分) 本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y),请你编写程序找出冠军和菜鸟.我们 ...
- poj 1719 Shooting Contest (二分匹配)
Shooting Contest Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 3812 Accepted: 1389 ...
- PAT(B) 1082 射击比赛(Java)
题目链接:1082 射击比赛 (20 point(s)) 题目描述 本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y ...
- PAT Basic 1082 射击比赛 (20 分)
本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y),请你编写程序找出冠军和菜鸟.我们假设靶心在原点(0,0). 输入 ...
- 1082 射击比赛 (20 分)C语言
本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y),请你编写程序找出冠军和菜鸟.我们假设靶心在原点(0,0). 输入 ...
随机推荐
- servlet在地址栏填写参数
单个参数:以"?"开头+参数名+"="符号+参数值 例如 https://i.cnblogs.com/EditPosts.aspx?opt=1 多个参数:以&q ...
- 让simplejson支持datetime类型的序列化
simplejson是Python的一个json包,但是觉得有点不爽,就是不能序列化datetime,稍作修改就可以了: 原文:http://blog.csdn.net/hong201/article ...
- HUAWEI USG6000系列 & NGFW Module V100R001 典型配置案例
https://support.huawei.com/enterprise/zh/doc/DOC1000047742?section=j00d
- PyCharm安装使用 激活码
从pycharm官网 [http://www.jetbrains.com/pycharm/download/#section=windows]下载完整安装包 激活码激活 优点:Window.Mac.U ...
- centos环境gcc版本升级
今天项目需要做node.js项目的性能测试,通过在centos上搭建nodejs环境 安装过程中提示:
- 关于java中的伪共享的认识和解决
在并发编程过程中,我们大部分的焦点都放在如何控制共享变量的访问控制上(代码层面),但是很少人会关注系统硬件及 JVM 底层相关的影响因素: CPU缓存 网页浏览器为了加快速度,会在本机存缓存以前浏览过 ...
- day9.初始函数练习题
1.写函数,检查获取传入列表或元组对象的所有奇数位索引对应的元素,并将其作为新列表返回给调用者. def new(args): a = [] for I in range(1,len(args),2) ...
- idea创建项目报错(Maven execution terminated abnormally (exit code 1) )解决方案
版本: idea14.0.2 java1.8 maven3.5 -------------------------------------------------------------------- ...
- jQuery懒加载插件 – jquery.lazyload.js简单调用
Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器可视区域外的图片不会被载入, 直到用户将页面滚动到它们所在的位置. 这与图片预 ...
- psp表格记录-
PSP2.1 Personal Software Process Stages Time Planning 计划 · Estimate · 估计这个任务需要多少时间 12 Development 开发 ...