ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

翻译联系 Day13

2022-01-29 23:00:19  阅读:251  来源: 互联网

标签:翻译 联系 segments 样例 number nail Day13 integer line


题目:Segments | JXNUOJ

翻译:

Segments

1000ms 262144K

描述:

You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails needed to nail all the segments down?

x轴上有n个线段。您可以在牛轴线钉上的任何整数点上钉一个钉子,这样,包含这个点的所有线段都被认为钉住了。如果钉子穿过某一节段的端点,则认为这一节段也被钉住了。要把所有的线段钉进去,最少要用多少个钉子?

输入:

The first line of the input contains single integer number n (1 ≤ n ≤ 1000) — amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers — endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points.

输入的第一行包含单个整数n(1≤n≤1000)-——段的数量。下面的n行包含片段的描述。每个描述是一对整数-——端点坐标。所有坐标的绝对值都不超过10000。段可以变成为点。

输出:

The first line should contain one integer number — the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any.

第一行应该包含一个整数———钉住所有线段所需的最小数目。第二行应该包含用空间以任意顺序分隔的打入钉的坐标。如果答案不唯一,则输出任意一个。

样例输入:

2
0 2
2 5

样例输出:

1
2 

样例输入:

5
0 3
4 2
4 8
8 10
7 7

样例输出:

3
7 10 3

标签:翻译,联系,segments,样例,number,nail,Day13,integer,line
来源: https://www.cnblogs.com/shw940795634/p/15856070.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有