I have to say that bastcoder is a hack game !!!
Question: How many chairs are required for all guests to sit in !!
It's a processing interval !!! Like HDU 1556, my water is like a year, and my water is like a year !!!!
The biggest overlap interval is used. We only need to mark the number of people in each interval !!!
Then the statistics will be okay from 0 to 1440 !!
The AC code is as follows:
#include<iostream>#include<cstdio>#include<cmath>#include<map>#include<algorithm>#include<cstring>#define ll long longusing namespace std;struct h{ int r,h1,m1,h2,m2;}a[10005];int main(){ int t; cin>>t; int i,j; int b[2000]; while(t--) { memset(b,0,sizeof b); int n; cin>>n; for(i=0;i<n;i++) { scanf("%d %d:%d %d:%d",&a[i].r,&a[i].h1,&a[i].m1,&a[i].h2,&a[i].m2); a[i].m1=a[i].m1+60*a[i].h1;a[i].m2=a[i].m2+60*a[i].h2; b[a[i].m1]+=a[i].r;b[a[i].m2]-=a[i].r; } int maxx; maxx=0; int ans=0; for(i=0;i<=1440;i++) { ans+=b[i]; if(ans>maxx) maxx=ans; } cout<<maxx<<endl; } return 0;}