Table Tennis Room

So, we have ping pong room for pastime.

But ping pong needs either two players or four players.

We want to know how many hours people could enjoy ping pong

as singles or doubles in a day.

Sample Data

case 1: [[9,10], [9,12]]

 

 

 

[start time, end time] ← available time to play ping pong.

Condition: working hour is 9-18,

Ping pong table is only one

Sample Data

case 1: [[9,10], [9,12]]

Ans: singles 1 hour, doubles 0 hours

 

[start time, end time] ← available time to play ping pong.

Condition: working hour is 9-18,

Ping pong table is only one

Sample Data

 

case 2: [[9,12], [9,12], [9,12], [10,18]]

 

[start time, end time] ← available time to play ping pong.

Condition: working hour is 9-18,

Ping pong table is only one

Sample Data

 

case 2: [[9,12], [9,12], [9,12], [10,18]]

Ans: singles, 1 hours, doubles 2 hours

 

[start time, end time] ← available time to play ping pong.

Condition: working hour is 9-18,

Ping pong table is only one

Sample Data

 

case 3: [[9,10], [9,12], [13,18], [16,18], [14,18], [10,13], [15,18]]

Ans: singles 5 hours, doubles 2 hours

[start time, end time] ← available time to play ping pong.

Condition: working hour is 9-18,

Ping pong table is only one

Input: [[9,10], [9,12]]

Output: [1,0]

 

Input: [[9,10], [9,12], [13,15], [10,18]]

Output: [5,0]

 

Input: [[9,11], [12,14], [13,15], [11,18], [14,18], [10,14], [15,18]]

Output: [7,1]

 

Input: [[9,10], [9,12], [14,15], [16,18], [14,18], [10,13], [15,18], [10,14], [9,13]]

Output: [6,2]

 

Input:[[9,14],[15,17],[12,13],[16,18],[10,15],[14,16],[9,13],[9,15]]

Output: [5,3]

Hint

9 10 11 12 13 14 15 16 17 18
person1
person2
person3
person4
person5

[[9,13],[11,15],[10,16],[17,18],[11,18]]

Singles 5 hours, Doubles 2 hours 

Output[5,2]

Made with Slides.com