answer has to be in C++ or Java covering segments by points Given n segments, find the minimal possible number of points such that each segment contains at least one point. The first line contains the number 1≤n≤100 of segments. Each of the following n li

computer science

Description

answer has to be in C++ or Java covering segments by points Given n segments, find the minimal possible number of points such that each segment contains at least one point. The first line contains the number 1≤n≤100 of segments. Each of the following n lines contains two integers 0≤l≤r≤109 defining the endpoints of a segment. Output the optimal number m of points and then m points. Sample Input 1: 3 1 3 2 5 3 6 Sample Output 1: 1 3 Sample Input 2: 4 4 7 1 3 2 5 5 6 Sample Output 2: 2 3 6 Memory Limit: 256 MB Time Limit: 1 seconds

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.