首页 > 代码库 > BestCoder Round #2

BestCoder Round #2

TIANKENG’s restaurant http://acm.hdu.edu.cn/showproblem.php?pid=4883

竟然暴力1.44*10^7  还要*T=100  竟然过了

 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #define mt(a,b) memset(a,b,sizeof(a)) 5 using namespace std; 6 const int M=1450; 7 int sum[M]; 8 int main(){ 9     int t,n;10     while(~scanf("%d",&t)){11         while(t--){12             scanf("%d",&n);13             mt(sum,0);14             while(n--){15                 int add,sx,sy,ex,ey;16                 scanf("%d %d:%d %d:%d",&add,&sx,&sy,&ex,&ey);17                 sx=sx*60+sy+1;18                 ex=ex*60+ey;19                 for(int i=sx;i<=ex;i++) sum[i]+=add;20             }21             int big=0;22             for(int i=0;i<M;i++){23                 big=max(big,sum[i]);24             }25             printf("%d\n",big);26         }27     }28     return 0;29 }
View Code