You are on page 1of 2

Question1 - Ping pong room:

We have ping pong room in our office and there is one table.
What we want to know is when we know people's availability for their playing time, how
many hours can we play either singles or doubles in a day.

Condition:
The working hours are 9-18.
The table is only one table.
When gathering two, three people, we can play singles.
When gathering over four people, we can play doubles.

Input:
The first line of the input givens the number of players T, T players available time follow.
Each consists of one line with Integer S E. S represents start time, and E resresents end time.

Ex:
"2
9 10
9 12"
It means 2 players can play ping pong. The 1st player can play from 9 to 10 and the 2nd
player can play ping pong from 9 to 12.

Output:
The output one line containing x y. where x is singles hours count and y is double hours.
The above input means player 1 can play ping pong from 9 to 10, and player 2 can play ping
pong from 9 to 12.

So expected output of above example is


10

Q1 Input
2
9 10
9 12
Output 1 0

Q2 Input
4
9 10
9 12
13 15
10 18"
Output 5 0

Q3 Input
7
9 11
12 14
13 15
11 18
14 18
10 14
15 18
Output 7 1

You might also like