Grand sale

3

1 votes
Algorithms, Approved, Dynamic Programming, Hard, Recruit
Problem

An e-commerce company is afraid of overloads on its website. So they have planned to use dedicated servers for each item going on sale. To minimize the cost, they are required to manage the traffic with a minimal number of servers. Additionally, each server needs 5 minutes time to be switched for its use from the current item to another. For the first item the server handles, it does not take any time as it had been configured a day before. Write a program to manage the servers.

Input format

  • First line: n denoting the number of items on sale
  • Next n lines: Format hh mm HH MM where hh mm is the starting time and HH MM is the ending time of an item's sale (both inclusive)

Output format

Print the minimum number of servers required to accomplish an issue of free sale.

Note

  • hh mm is represented in 24-hour format.
  • If a sale finishes at 10 20 and another sale starts at 10 25, then the same server can be used as they have a 5-minute time gap.

Constraints

1n1000

00hh,HH23

00mm,MM59

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?