How to solve this segment based problem ?

Правка en1, от 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.

Теги segments

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский WorstCoder45 2020-08-26 22:48:36 840 Initial revision (published)