A. Free Cash
2 seconds
256 megabytes
standard input
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.
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.
Print a single integer — the minimum number of cashes, needed to serve all clients next day.
4
8 0
8 10
8 10
8 45
2
3
0 12
10 11
22 22
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.
#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的更多相关文章
- Poj 1276 Cash Machine 多重背包
Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26172 Accepted: 9238 Des ...
- 财务报表 > 现金流表的直接法,间接法,Cash Flow from Operating Activites
经营活动现金流量 Cash Flow from Operating Activites 是指企业投资活动和筹资活动以外的所有的交易和事项产生的现金流量.它是企业现金的主要来源. 1. 直接法经营活动现 ...
- poj 1276 Cash Machine(多重背包)
Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 33444 Accepted: 12106 De ...
- 【BZOJ-1492】货币兑换Cash DP + 斜率优化 + CDQ分治
1492: [NOI2007]货币兑换Cash Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 3396 Solved: 1434[Submit][Sta ...
- Cash Cow【dfs较难题应用】【sdut2721】
Cash Cow Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 题目链接:http://acm.sdut.edu.cn/sdut ...
- [NOI2007 Day1] 货币兑换 Cash
vijos P1508 / BZOJ 1492 膜拜了这么久的cdq分治,终于有机会亲自来写了.虽然这个思想很好理解,先做前一半,计算前一半对后一半的影响,再做后一半.但是由于我这个傻Ⅹ,以前既没有做 ...
- POJ 1276 Cash Machine
Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24213 Accepted: 8476 Descrip ...
- Cash Machine_多重背包
Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver ap ...
- Cash flow
Today,we learn about the cash flow. Cash flow summary: 1.The cash flow identity:(现金恒等式) cash flow fr ...
- 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 ...
随机推荐
- springmvc 中异常处理
springmvc 中异常处理常见三种处理方式: 1:SimpleMappingExceptionResolver处理的是处理器方法里面出现的异常 2 3.自定义异常处理器:处理的是处理器方法里面出现 ...
- 201671010127 2016—2017-2 java学习新征程
通过大一整个学年对Python和C语言的学习,我对编程的感受有了更进一步的认识.随着时代的进步,编程语言也在实时更新,面对越来越多的编程语言,对于在编程方面的初学者,选择一门适合自己的编程语言就显得十 ...
- day70-oracle 12-触发器
查询是没有触发器的.trigger是一个数据库的对象.PL/SQL程序是在我插入之前执行还是在插入之后执行?触发器类似于java中的监听器. 监听插入操作,执行一段PLSQL程序. 禁止在非工作时间插 ...
- HDU 4879 ZCC loves march (并查集,set,map)
题面以及思路:https://blog.csdn.net/glqac/article/details/38402101 代码: #include <bits/stdc++.h> #defi ...
- 标签控件JLabel的使用
---------------siwuxie095 工程名:TestUI 包名:com.siwuxie095.ui 类名:TestLabel.j ...
- Struts2 看1
Struts2部分 1. JavaEE软件三层结构和MVC的区别? JavaEE软件三层机构是由sun公司提供JavaEE开发规范的:Web层(表现层).业务逻辑层.数据持久层.[其中WEB层会使用前 ...
- 校园客户端(DR)启动后提示我们缺失packet.dll,无法正常启动(7)
有的时候校园客户端(DR)启动后提示我们缺失packet.dll,无法正常启动,然而我们重装了客户端后任然不感冒,那么问题来了,问题解决不了往往源于我们对问题的本质不够了解,如果了解问题的本质,那么问 ...
- STM32 CAN控制器简介
1.STM32自带了基本扩展CAN外设,又称bxCAN,bxCAN的特点如下: 2.模式:分为工作模式.测试模式.调试模式 睡眠模式主要用于降低功耗! 在静默模式下的工作原理 由图可知,它只会接受来自 ...
- Entity Framework Tutorial Basics(27):Update Entity Graph
Update Entity Graph using DbContext: Updating an entity graph in disconnected scenario is a complex ...
- PHP 查看扩展信息的命令
PHP 查看扩展信息的命令 这里以查看 Swoole 扩展信息为例. root@639ca1f15214:~# php --ri swoole // php --ri [扩展名称] swoole sw ...