Problem Description:tiankeng manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to H Ave 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? 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 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. Output:for each test case, output the minimum number of chair that Tiankeng needs to prepare. Sample input:226 09:005 08:59 09:5926 09:005-10:00am Sample output:116Test Instructions: Every time the restaurant comes to x people, we need at least how many stools we have to prepare (the minimum number of stools we require when we have the most restaurants in a time period).
#include <stdio.h>#include<string.h>#include<math.h>#include<stdlib.h>#include<queue>#include<algorithm>using namespacestd;Const intn=1e5+Ten;Const intm=50000;Const intinf=0x3f3f3f3f;intA[n];intMain () {intT, N, S1, E1, S2, E2, X, S, E, I, ans, Max; scanf ("%d", &T); while(t--) {memset (A,0,sizeof(a)); Ans=0; Max=0; scanf ("%d", &N); for(i =0; I < n; i++) {scanf ("%d", &x); scanf ("%d:%d%d:%d", &s1, &s2, &e1, &E2); S= s1* -+s2+1; E= e1* -+e2+1; A[s]+=x; A[e]-=x; } for(i =0; i < N; i++) {ans+=A[i]; Max=Max (ans, max); } printf ("%d\n", Max); } return 0;}
HDU 4883 Tiankeng ' s restaurant (Bestcoder Round #2)