博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
杭电4883--TIANKENG’s restaurant(区间覆盖)
阅读量:6548 次
发布时间:2019-06-24

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

TIANKENG’s restaurant

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)

Total Submission(s): 1536    Accepted Submission(s): 556

Problem Description
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
 

 

Source
 

 

Recommend
liuyiding   |   We have carefully selected several similar problems for you:            
大神各种有啊, 虐心的一天;
区间覆盖, 求最大重合数。 (理解成了普通贪心做, 一直WA),这两种做法到底有什么区别?
1 #include 
2 #include
3 #include
4 #include
5 #include
6 using namespace std; 7 int num[1450]; 8 bool cmp(int a, int b) 9 {10 return a > b;11 }12 int main()13 {14 int m, t;15 scanf("%d", &t);16 while(t--)17 {18 memset(num, 0, sizeof(num));19 scanf("%d", &m);20 while(m--)21 {22 int a, b, c, d, e, maxx = 0;23 scanf("%d %d:%d %d:%d", &a, &b, &c, &d, &e);24 int time1 = b*60 + c;25 int time2 = d*60 + e;26 for(int i=time1; i

 

 
 

转载于:https://www.cnblogs.com/soTired/p/4694065.html

你可能感兴趣的文章
恢复文件关联
查看>>
同步与异步,回调与协程
查看>>
linux gcc 区分32位或64位编译
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
学习shell的第二天
查看>>
tracert 路由跟踪信息
查看>>
我的友情链接
查看>>
mysql主从复制
查看>>
chosen美化下拉框
查看>>
软件测试人员考核办法
查看>>
android動態產生物件、CheckBox、Array、android:onClick
查看>>
掌握IIS排错技巧 让Web更好服务
查看>>
CentOS系统程序包管理之---rpm、yum和编译
查看>>
我的友情链接
查看>>
MySQL基准测试工具-mysqlslap
查看>>
error: command 'x86_64-linux-gnu-gcc' failed
查看>>
windows邮件服务器搭建
查看>>
前端md5加密技术,防止数据传输过程中被截取
查看>>
服务器租用注意事项
查看>>