hdu 3650 Hot Expo

最大子重叠即是答案,注意到同一时间不能出现在两个地方。

#include<cstdio>
#include<cstring>
int c[1000000];
int main()
{
	int n,b,a;
	while(scanf("%d",&n)&&n)
	{
		int max=-1;
		memset(c,0,sizeof(c));
		for(int i=1;i<=n;i++)
		{
			scanf("%d%d",&a,&b);
			for(int j=a;j<=b;j++)
			{
				c[j]++;
				if(c[j]>max)
					max=c[j];
			}
		}
		printf("%d\n",max);
	}
	return 0;
}


你可能感兴趣的:(hdu 3650 Hot Expo)