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 day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours mi 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.

Input

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 hi and mi (0 ≤ hi ≤ 23; 0 ≤ mi ≤ 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.

Output

Print a single integer — the minimum number of cashes, needed to serve all clients next day.

Examples
input

Copy
4
8 0
8 10
8 10
8 45
output

Copy
2
input

Copy
3
0 12
10 11
22 22
output

Copy
1
Note

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.

#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
bool cmp(int a,int b)
{
return a>b;
}
int a[],vis[];
int main()
{
int n,h,m;
while(cin>>n)
{
memset(vis,,sizeof(vis));
for(int i=;i<n;i++)
{
cin>>h>>m;
a[i]=h*+m;
vis[a[i]]++;;
}
sort(vis,vis+,cmp);
cout<<vis[]<<endl;
}
return ;
}

A. Free Cash的更多相关文章

  1. Poj 1276 Cash Machine 多重背包

    Cash Machine Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 26172   Accepted: 9238 Des ...

  2. 财务报表 > 现金流表的直接法,间接法,Cash Flow from Operating Activites

    经营活动现金流量 Cash Flow from Operating Activites 是指企业投资活动和筹资活动以外的所有的交易和事项产生的现金流量.它是企业现金的主要来源. 1. 直接法经营活动现 ...

  3. poj 1276 Cash Machine(多重背包)

    Cash Machine Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 33444   Accepted: 12106 De ...

  4. 【BZOJ-1492】货币兑换Cash DP + 斜率优化 + CDQ分治

    1492: [NOI2007]货币兑换Cash Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 3396  Solved: 1434[Submit][Sta ...

  5. Cash Cow【dfs较难题应用】【sdut2721】

    Cash Cow Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 题目链接:http://acm.sdut.edu.cn/sdut ...

  6. [NOI2007 Day1] 货币兑换 Cash

    vijos P1508 / BZOJ 1492 膜拜了这么久的cdq分治,终于有机会亲自来写了.虽然这个思想很好理解,先做前一半,计算前一半对后一半的影响,再做后一半.但是由于我这个傻Ⅹ,以前既没有做 ...

  7. POJ 1276 Cash Machine

    Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24213 Accepted: 8476 Descrip ...

  8. Cash Machine_多重背包

    Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver ap ...

  9. Cash flow

    Today,we learn about the cash flow. Cash flow summary: 1.The cash flow identity:(现金恒等式) cash flow fr ...

  10. The finnacial statements,taxes and cash flow

    This chapter-2 we learn about the the financial statements(财务报表),taxes and cash flow.We must pay par ...

随机推荐

  1. 第一天:tomcat相关知识和浏览器的访问机制

    1.tomcat的目录结构 1)bin目录:启动和关闭tomcat以及其他的脚本命令  2)conf目录:存放各种配置文件 a.server.xml配置文件的配置: *<host/>标签: ...

  2. jQuery-图片的放大镜显示效果(不需要大小图)

    问题:当页面高度很大时,放大图片的图层不会跟随着 1.demo.html ;display:none;}          #tip s   {position:absolute;top:40px;l ...

  3. GitHub Blog创建以及本地管理(转)

    GitHub Blog创建以及本地管理   创建 注册GitHub账户 首页点击新建仓库 New repository repository name必须为 Owner.github.io EX:我的 ...

  4. [转]AJAX工作原理及其优缺点

    1.什么是AJAX?AJAX全称为“Asynchronous JavaScript and XML”(异步JavaScript和XML),是一种创建交互式网页应用的网页开发技术.它使用:使用XHTML ...

  5. Switch/Case 的穿透性

    /*键盘录入1到12 ,对应输出该月份对应的季节 .如果输入的不是1到12,输出提示信息:您输入的数据有误. PS: 春季:3,4,5月份 夏季: 6,7,8月份 秋季: 9,10,11月份 冬季:1 ...

  6. IFC数据模型在三维引擎中模拟

  7. DesertWind TopCoder - 1570

    传送门 分析 首先我们要知道为了情况最坏,无论你到哪,一定会在你前往绿洲的最短路上的那片沙子上刮风,所以这个点到绿洲的最短路即为他相连的点中到绿洲距离最短的距离+3和次短的距离+1的最小值,具体实现见 ...

  8. javaSE阶段中 关于Sring类方法的应用

    String类中有很多常用的方法,今天就一些方法涉及到的一些常见题 做两个小Demo   其中一个要求如下: 获取指定字符串中,大写字母.小写字母.数字 的个数 题目分析 * 为了统计大写字母.小写字 ...

  9. 安装thrift时,注意openssl参数

    在安装基于openssl-1.0.1c的thrift-0.9.0时,正常使用--with-openssl在configure时会出错,报"Error: libcrypto required. ...

  10. 20169219《linux内核原理与分析》第九周作业

    网易云课堂学习 可执行程序的装载 可执行程序的产生过程:预处理-----> 编译 ----> 汇编 ----> 链接 以hello.c文件为例进行分析,编译步骤如下 vi hello ...