#include <cstdio>#include<cstring>#include<cmath>#include<algorithm>using namespacestd;Const intmaxn= the+Ten;intN,m,x1,y1,x2,y2;intU[MAXN],L[MAXN];intANS[MAXN];intANS[MAXN];BOOLFLAG[MAXN];structpoint{intx, y;} P[MAXN];Chars[10000];voidinit () {memset (flag,0,sizeofflag); memset (ans,0,sizeofans); memset (Ans,0,sizeofAns);}intFintA1,intB1,intA2,intB2) { //returns the cross product of a vector (A1,B1) and a vector (A2,B2) returna1*b2-a2*B1;}BOOLJudgeintA1,intB1,intA2,intB2,intA3,intB3,intA4,intB4,intAintB) { if(F (A2-A1,B2-B1,A-A1,B-B1) >0)return 0; if(F (A3-A2,B3-B2,A-A2,B-B2) >0)return 0; if(F (A4-A3,B4-B3,A-A3,B-B3) >0)return 0; if(F (A1-A4,B1-B4,A-A4,B-B4) >0)return 0; return 1;}intMain () { while(~SCANF ("%d",&N)) {if(!n) Break; scanf ("%d%d%d%d%d",&m,&x1,&y1,&x2,&Y2); Init (); for(intI=1; i<=n; i++) scanf ("%d%d",&u[i],&L[i]); u[0]=X1; l[0]=X1; U[n+1]=X2; L[n+1]=X2; Sort (U,u+n+2); Sort (l,l+n+2); for(intI=1; i<=m; i++) scanf ("%d%d",&p[i].x,&p[i].y); for(intI=0; i<=n; i++) { for(intj=1; j<=m; J + +) { if(flag[j]!=0)Continue; if(Judge (u[i],y1,u[i+1],y1,l[i+1],y2,l[i],y2,p[j].x,p[j].y)) Flag[j]=1, ans[i]++; } } for(intI=0; i<=n;i++) ans[ans[i]]++; printf ("box\n"); for(intI=1; i<=n;i++) if(Ans[i]) printf ("%d:%d\n", I,ans[i]); } return 0;}
POJ 2398 Toy Storage