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). 输入 ...
随机推荐
- Scrapy项目创建以及目录详情
Scrapy项目创建已经目录详情 一.新建项目(scrapy startproject) 在开始爬取之前,必须创建一个新的Scrapy项目.进入自定义的项目目录中,运行下列命令: PS C:\scra ...
- SqlServerHelp
using System; using System.Collections.Generic; using System.Reflection; using System.Text; using Sy ...
- IPMI无法执行命令
IPMI无法执行命令 https://www.cnblogs.com/EricDing/p/8995263.html http://www.cnblogs.com/heidsoft/p/4014301 ...
- WMSYS.WM_CONCAT返回CLOB类型的解决办法
https://blog.csdn.net/cnm_csdn_wt/article/details/80047878
- zookeeper 学习 客户端Acl操作笔记
Acl = Access control list create /node2 node2data [zk: localhost:2181(CONNECTED) 14] addauth digest ...
- CTAP: Complementary Temporal Action Proposal Generation (ECCV2018)
互补时域动作提名生成 这里的互补是指actionness score grouping 和 sliding window ranking这两种方法提proposal的结合,这两种方法各有利弊,形成互补 ...
- reconnecting-websocket.js
websocket是HTML5下一个不错的网络协议解决方案,有一个场景很多猿猿都会遇到,手机锁屏后大约60秒,IOS会自动断开websocket连接,连接丢失了,那我们的数据也就断了.websocke ...
- bzoj2683&&bzoj4066
题解: 前一题不是强制在线,后一题是强制在线 树套树空间会炸 说一下cdq分治+树状数组 首先我们利用cdq分治使得查询和操作保证先后关系 然后矩阵查询变成4个矩阵的差 那么我们就可以运用扫描线的方法 ...
- drone的pipeline原理与代码分析
最近的一个项目,需要实现一个工作任务流(task pipeline),基于之前CICD的经验,jenkins pipeline和drone的pipeline进入候选. drone是基于go的cicd解 ...
- grails2.3.3发布了-【grails】
grails2.3.3发布了,在grails2.3.2中默认方式fork模式下无法运行的BUG也解决了. 需要做的相关修改为修改BuildConfig.groovy: build ':tomcat:7 ...