CF237A.Free Cash
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at h__i hours m__i minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than he doesn't want to wait and leaves the cafe immediately.
Valera is very greedy, so he wants to serve all n customers next day (and get more profit). However, for that he needs to ensure that at each moment of time the number of working cashes is no less than the number of clients in the cafe.
Help Valera count the minimum number of cashes to work at his cafe next day, so that they can serve all visitors.
瓦列拉经营着一家24/7营业的快餐咖啡馆。他神奇地得知,第二天将有 n 位顾客光顾他的咖啡馆。对于每位顾客,我们知道其到达时间:第 i 位顾客恰好在 hi 时 mi 分到达。咖啡馆为每位顾客提供服务耗时不足一分钟;但如果某位顾客到达时发现所有收银台均被占用,则他不愿等待,并立即离开咖啡馆。
瓦列拉非常贪婪,因此他希望第二天能为全部 n 位顾客提供服务(从而获取更多利润)。然而,为此他必须确保在任意时刻,正在工作的收银台数量不少于咖啡馆内顾客的数量。
请帮助瓦列拉计算:第二天咖啡馆至少需要安排多少个收银台同时工作,才能为所有到访顾客提供服务。
输入格式
The first line contains a single integer n (1 ≤ n ≤ 105), that is the number of cafe visitors.
Each of the following n lines has two space-separated integers h__i and m__i (0 ≤ h__i ≤ 23; 0 ≤ m__i ≤ 59), representing the time when the i-th person comes into the cafe.
Note that the time is given in the chronological order. All time is given within one 24-hour period.
第一行包含一个整数 n(1≤n≤105),表示咖啡馆访客的人数。
接下来的 n 行,每行包含两个以空格分隔的整数 hi 和 mi(0≤hi≤23;0≤mi≤59),表示第 i 个人进入咖啡馆的时间。
注意:所给时间按时间顺序排列。所有时间均位于同一个 24 小时周期内。
输出格式
Print a single integer — the minimum number of cashes, needed to serve all clients next day.
输出一个整数——即第二天服务所有客户所需的最少收银台数量。
输入输出样例
输入#1
4 8 0 8 10 8 10 8 45
输出#1
2
输入#2
3 0 12 10 11 22 22
输出#2
1
说明/提示
In the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.
In the second sample all visitors will come in different times, so it will be enough one cash.
在第一个样例中,仅有一个收银台不足以服务所有顾客,因为将有两位顾客于 8:10 进入咖啡馆。因此,若咖啡馆中仅设一个收银台,则其中一位顾客可被服务,而另一位顾客将不愿等待并直接离开。
在第二个样例中,所有顾客均在不同时间到达,因此一个收银台便已足够。
输入解题思路,AI测评打分。不知道怎么写?