Hangzhou Electric 4883 Tiankeng ' s restaurant (minimum seat required for hotel)

Source: Internet
Author: User

DescriptionTiankeng manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to has meal because of Its delicious dishes. Today n Groups of customers come to enjoy their meal, and there is Xi persons in the ith group in sum. Assuming that all customer can own only one chair. Now we know the arriving time STi and departure time EDi for each group. Could Tiankeng Calculate the minimum chairs he needs to prepare so that every customer can take a seat when Arriv ing the restaurant?InputThe 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 was 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& LT;60), Given that the arriving time must be earlier than the departure time.

Pay attention if a group of people arrive at the restaurant as soon as a group of people leaves from the restaurant , then the arriving group can is arranged to take their seats if the seats is enough.OutputFor each test case, the output of the minimum number of chair is Tiankeng needs to prepare.Sample Input226 08:00 09:005 08:59 09:5,926 08:00 09:005 09:00 10:00Sample Output116find the maximum number of hotels per minute
1#include <cstdio>2 intMain ()3 {4     intt,n,i,j,h1,h2,m1,m2,p;5scanf"%d",&t);6      while(t--)7     {8         intb[10000]={0};9         intmax=0;Tenscanf"%d",&n); One          for(i=0; i<n;i++) A         { -scanf"%d%d:%d%d:%d",&p,&h1,&m1,&h2,&m2); -H1=h1* -+M1; theh2=h2* -+m2; -              for(j=h1;j) -             { -b[j]+=p; +MAX=MAX&GT;B[J]?Max:b[j]; -             } +         } Aprintf"%d\n", max); at          -     } -}

Hangzhou Electric 4883 Tiankeng ' s restaurant (minimum seat required for hotel)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.