博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
<Codeforces Round #147 (Div. 2)>A. Free Cash(水题)
阅读量:6160 次
发布时间:2019-06-21

本文共 2306 字,大约阅读时间需要 7 分钟。

A. Free Cash
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.

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 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.

AC Code:

1 #include 
2 #include
3 4 int t[24][60]; 5 6 int main() 7 { 8 int h, m, n, max; 9 while(scanf("%d", &n) != EOF)10 {11 max = 0;12 memset(t, 0, sizeof(t));13 while(n--)14 {15 scanf("%d %d", &h, &m);16 t[h][m]++;17 }18 for(int i = 0; i < 24; i++)19 for(int j = 0; j < 60; j++)20 if(max < t[i][j])21 max = t[i][j];22 printf("%d\n", max);23 }24 return 0;25 }

 

转载地址:http://kqhfa.baihongyu.com/

你可能感兴趣的文章
WCF角色服务
查看>>
常用sql001_partition by 以及 row_number()和 dense_rank()和rank()区别
查看>>
dev c++ Boost库的安装
查看>>
[LeetCode] 518. Coin Change 2
查看>>
react+百度地图实现自定义图标
查看>>
Java编译期优化思维导图
查看>>
前端自动化开发环境
查看>>
基于 Generator 和 Iterator 的惰性列表
查看>>
JS -- http、https地址自动检测并添加为链接
查看>>
JS正则表达式
查看>>
关于vue中next和Tick(nextTick)的一点理解
查看>>
聊聊rocketmq的FileAppender
查看>>
Vue登录注册,并保持登录状态
查看>>
Asciidoctor Maven插件使用
查看>>
RBAC-基于角色的权限管理
查看>>
ES6 札记:函数
查看>>
如何进行多云环境中的数据管理?
查看>>
Vuex源码阅读分析
查看>>
samba服务
查看>>
个推 Spark实践教你绕过开发那些“坑”
查看>>