How to solve this segment based problem ?

Revision en1, by WorstCoder45, 2020-08-26 22:48:36

This problem is from some old contest of codeforces , I don't remember its name anymore . But the problem idea seems interesting.

Problem :

Given $$$n$$$ segments $$$[l,r]$$$ , segment $$$[l1,r1]$$$ belongs to the first person, $$$[l2,r2]$$$ belongs to the second person, and so on...

Each person should select any one day/number from his own segment.

We have to find any assignment for every person to a particular day, such that every person has selected a unique day .

Example :

Range of first person : $$$[1,5]$$$

Range of second person : $$$[7,8]$$$

Solution : First person selects day-1 and second person selects day 7.

Another example :

Range of first person : $$$[1,2]$$$

Range of second person : $$$[1,3]$$$

Solution : First person selects day-1 and second person selects day 2.

Tags segments

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English WorstCoder45 2020-08-26 22:48:36 840 Initial revision (published)