A8689 | Free Cash
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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<=10^{5})$ , 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.
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.
输出格式
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.
In the second sample all visitors will come in different times, so it will be enough one cash.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted