TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to have meal because of its delicious dishes. Today n groups of customers come to enjoy their meal, and there are Xi persons in the ith group in sum. Assuming that each customer can own only one chair. Now we know the arriving time STi and departure time EDi of each group. Could you help TIANKENG calculate the minimum chairs he needs to prepare so that every customer can take a seat when arriving the restaurant?

Input

The first line contains a positive integer T(T<=100), standing for T test cases in all.

Each cases has a positive integer n(1<=n<=10000), which means n groups of customer. Then following n lines, each line there is a positive integer Xi(1<=Xi<=100), referring to the sum of the number of the ith group people, and the arriving time STi and departure time Edi(the time format is hh:mm, 0<=hh<24, 0<=mm<60), Given that the arriving time must be earlier than the departure time.

Pay attention that when a group of people arrive at the restaurant as soon as a group of people leaves from the restaurant, then the arriving group can be arranged to take their seats if the seats are enough.

Output

For each test case, output the minimum number of chair that TIANKENG needs to prepare.

Sample Input

2

2

6 08:00 09:00

5 08:59 09:59

2

6 08:00 09:00

5 09:00 10:00

Sample Output

11

6

//#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<math.h>
#include<cstdio>
#include<sstream>
#include<numeric>//STL数值算法头文件
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<functional>//模板类头文件
using namespace std; const int INF=1e9+7;
const int maxn=11000;
typedef long long ll; //暴力!!!
//首先,电脑读数的时候竟然是从第一个不是0的开始的!!!
//其次,这一道题用暴力,一天一共1440分钟,所以你把开始时间和结束时间
//化为分钟,然后在区间取x的最大值就是这一的答案 int a[maxn]; int main ()
{
int t,n;
int x,h,m;
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
memset(a,0,sizeof (a));
for(int i=0; i<n; i++)
{
scanf ("%d", &x);
scanf ("%d:%d", &h, &m);
a[h * 60 + m] += x;
scanf ("%d:%d", &h, &m);
a[h * 60 + m] -= x;
}
int sum = 0;
int maxx = 0;
for (int i = 0; i < maxn; i++)
{
sum += a[i];
if (sum > maxx)
maxx=sum;
}
printf("%d\n",maxx);
}
return 0;
}

TIANKENG’s restaurant HDU - 4883 (暴力)的更多相关文章

  1. HDU 4883 TIANKENG’s restaurant Bestcoder 2-1(模拟)

    TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/O ...

  2. HDU 4886 TIANKENG’s restaurant(Ⅱ) ( 暴力+hash )

    TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 130107/65536 K (Ja ...

  3. hdoj 4883 TIANKENG’s restaurant【贪心区间覆盖】

    TIANKENG’s restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/O ...

  4. HDOJ 4883 TIANKENG’s restaurant

    称号: TIANKENG's restaurant Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Ja ...

  5. hdu 4883 思维题

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 TIANKENG’s restaurant Time Limit: 2000/1000 MS (Ja ...

  6. hdu4886 TIANKENG’s restaurant(Ⅱ) (trie树或者模拟进制)

    TIANKENG’s restaurant(Ⅱ) Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 130107/65536 K (Ja ...

  7. HDU 4883 TIANKENG’s restaurant

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4883 解题报告:一家餐馆一天中有n波客人来吃饭,第 i 波  k 客人到达的时间是 s ,离开时的时间 ...

  8. HDU 4883 TIANKENG’s restaurant (贪心)

    链接:pid=4883">带我学习.带我飞 第一次BC,稳挂,WA n多次.今天又一次做了一下 略挫 #include <iostream> #include <cs ...

  9. HDU 4883 Best Coder Round 2 TIANKENG’s restaurant 解读

    有一组数据是在客人到达和出发时间,问:多少把椅子的能力,以满足所有客人的需求,可以有一个地方坐下要求. 有些人甚至开始考虑暴力法,这些数据是少,其实这个问题很多数据, 暴力需求O(n*n)的时间效率, ...

随机推荐

  1. Mysql优化小记1

    在项目开发中,需要写个windows服务从sqlserver复制数据到mysql(5.6.13 Win64(x86_64)),然后对这些数据进行计算分析.每15分钟复制一次,每次复制大概200条数据, ...

  2. 【NOIP】提高组2012 疫情控制

    [题意]n个点的树,1为根,要求删除一些点使得截断根节点和所有叶子结点的路径(不能删根,可以删叶子).有m支军队在m个点上,每时刻所有军队可以走一步,最终走到的地方就是删除的点,求最短时间. [算法] ...

  3. flask函数已定义参数却出现takes 0 positional arguments but 1 was given的问题

    在flask中定义了一个简单的删除数据库内容的路由 测试却发现一直报错 说delete_history函数定义时没有接受参数,但是检查delete_history函数却发现没有问题 后来想了半天才发现 ...

  4. js中的true和false

    1.false undefined.NaN.0.null和空字符串''均被视为false 2.true 除上述以外的其它情况一律被视作true

  5. 关于shutdown和close

    示例代码: void str_cli(FILE *fp, int sockfd) { pid_t pid; char sendline[MAXLINE], recvline[MAXLINE]; ) { ...

  6. 机器学习开源项目精选TOP30

    本文共图文结合,建议阅读5分钟. 本文为大家带来了30个广受好评的机器学习开源项目. 640?wx_fmt=jpeg&wxfrom=5&wx_lazy=1 最近,Mybridge发布了 ...

  7. 0x3F3F3F3F——ACM中的无穷大常量

    在算法竞赛中,我们常常需要用到设置一个常量用来代表“无穷大”. 比如对于int类型的数,有的人会采用INT_MAX,即0x7fffffff作为无穷大.但是以INT_MAX为无穷大常常面临一个问题,即加 ...

  8. 类似于input输入框placeholder的效果,兼容ie8

    $(function(){    //判断浏览器是否支持placeholder属性  supportPlaceholder='placeholder'in document.createElement ...

  9. recv函数的MSG_PEEK标志介绍

    考虑下面的场景,server向client发送数据"_META_DATA_\r\n_USER_DATA_",要求"\r\n"之前的数据_META_DATA_在第 ...

  10. 七:zooKeeper开源客户端ZkClient的api测试

    ZkClient是Gitthub上一个开源的ZooKeeper客户端.ZKClient在ZooKeeper原生API接口之上进行了包装,是一个更加易用的ZooKeeper客户端.同时ZKClient在 ...