Ural 1303. Minimal Coverage
来源:互联网 发布:php小项目源码 编辑:程序博客网 时间:2024/06/13 23:17
1303. Minimal Coverage
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
Given set of line segments [Li, Ri] with integer coordinates of their end points. Your task is to find the minimal subset of the given set which covers segment [0, M] completely (M is a positive integer).
Input
First line of the input contains an integer M (1 ≤ M ≤ 5000). Subsequent lines of input contain pairs of integers Li and Ri (−50000 ≤ Li < Ri ≤ 50000). Each pair of coordinates is placed on separate line. Numbers in the pair are separated with space. Last line of input data contains a pair of zeroes. The set contains at least one and at most 99999 segments.
Output
Your program should print in the first line of output the power of minimal subset of segments which covers segment [0, M]. The list of segments of covering subset must follow. Format of the list must be the same as described in input with exception that ending pair of zeroes should not be printed. Segments should be printed in increasing order of their left end point coordinate.
If there is no covering subset then print “No solution” to output.
Samples
1-1 0-5 -32 50 0
No solution
1-1 00 10 0
10 1
Problem Source: II Collegiate Students Urals Programming Contest. Yekaterinburg, April 3-4, 1998
Difficulty: 240 Printable version Submit solution Discussion (29)
My submissions All submissions (12633) All accepted submissions (2717) Solutions rating (1696)
题意:给一些线段[l,r],求最少的线段能覆盖[0,m]区间
思路:
贪心,先按照起点排序,在取下一条线段时候,在不超过当前终点的条件下,能到达 的终点最远的
wa:看到有负的区间,想着要覆盖的是[0,m]的,就把负的值赋为0 ……却忘了输出要输出原线段 …………
傻了
0 0
- Ural 1303. Minimal Coverage
- URAL 1303. Minimal Coverage 贪心
- Ural 1303. Minimal Coverage / 最小区间覆盖
- Ural 1303 Minimal Coverage
- ural 1303 Minimal Coverage【贪心】
- ural Minimal Coverage (区间覆盖)
- URAL 1303 Minimal Coverage (贪心)
- URAL 1303. Minimal Coverage(最小覆盖 数学啊 )
- Ural 1303 Minimal Coverage(贪心)
- Ural 1303 Minimal Coverage(贪心)
- Timus 1303. Minimal Coverage
- 10020 - Minimal coverage
- UVa 10020 - Minimal coverage
- UVa 10020 - Minimal coverage
- uva 10020 - Minimal coverage
- uva 10020 - Minimal coverage
- 10020 - Minimal coverage
- uva10020 - Minimal coverage
- android之layout_toLeftOf和layout_toRightOf出现的错误
- 操作系统--Linux学习
- 搭建Jenkins+Github集成环境
- Linux下的C语言学习笔记(1)
- POJ 3258 River Hopscotch (二分 + 最大化最小值 + 模拟双向链表)
- Ural 1303. Minimal Coverage
- Arlequin
- 数据库问题原因详解(脏读、不可重复读、幻读)
- 顺序表应用2:多余元素删除之建表算法
- cdoj 1354 柱爷很忙
- 团队管理
- php class回顾篇
- linphone-LpConfigImpl文件对应的JNI层文件分析
- Android事件和事件监听 来个飞机设个背景图让飞机上下左右动