http://acm.hdu.edu.cn/showproblem.php?pid=1050
写此题写的非常不淡定。。
以至于WA了很多很多很多很多次。。明明是很简单的。 唉。
注意两点:①房间是对称分布的 ②挪桌子的房间序号的不一定是按照升序或者降序排列的。
#include <iostream>
using namespace std;
#define N 205
int room[N];
inline void swap(int &a,int &b){
int t;
t=a;
a=b;
b=t;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("1050in.txt","r",stdin);
#endif
int t,n,i,j,time;
scanf("%d",&t);
while (t--){
scanf("%d",&n);
time=0;
memset(room,0,sizeof(room));
while (n--){
scanf("%d%d",&i,&j);
if (i>j)
swap(i,j);
i=(i+1)/2;
j=(j+1)/2;
for (;i<=j;i++){
room[i]++;
if (room[i]>time)
time=room[i];
}
}
printf("%d\n",time*10);
}
return 0;
}