Time limit per test
2 seconds
Memory limit per test
256 megabytes
Input
Standard Input
Output
Standard output
Valera runs a 24/7 fast food cafe. He magically learned that next dayNPeople will visit his cafe. For each person we know the arrival time:
TheI-Th person comes exactlyHIHoursMIMinutes.
The cafe has Ds 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 allNCustomers 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.
Input
The first line contains a single integerN(1 digit ≤ DigitNLimit ≤ limit 105 ),
That is the number of CAFE visitors.
Each of the followingNLines has two space-separated IntegersHIAndMI(0 bytes ≤ bytesHILimit ≤ limit 23; 0 limit ≤ limitMILimit ≤ limit 59 ),
Representing the time whenI-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.
Output
Print a single integer-the minimum number of cashes, needed to serve all clients next day.
Sample test (s) Input
48 08 108 108 45
Output
2
Input
30 1210 1122 22
Output
1
Note
In the first sample it is not enough one cash to serve all clients, because two visitors will come into Cafe. 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.
Explanation: you only need to determine the maximum number of occurrences of the same time.
#include <iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;int main(){int i,n,j;int max;int temp;int a[100001],b[100001];max=1;temp=1;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}for(i=0;i<n;i++){temp=1;for(j=i+1;j<n;j++){if(a[j]==a[i]&&b[j]==b[i]){temp++;}else{break;}}if(temp>max){max=temp;}i=j-1;}printf("%d\n",max);return 0;}