noip2012初赛-坐标统计

来源:互联网 发布:无线网络控制软件 编辑:程序博客网 时间:2024/06/06 15:03

noip2012C-4-1(坐标统计)输入n个整点在平面上的坐标。对于每个点,可以控制所有位于它左下方的点(即x、y坐标都比它小),它可以控制的点的数目称为“战斗力”。依次输出每个点的战斗力,最后输出战斗力最高的点的编号(如果若干个点的战斗力并列最高,输出其中最大的编号)。

 

样例输入:

7

1 2

3 4

5 1

3 4

-1 6

-7-19

-2-10


constSIZE=100;varx,y,f:array[1..SIZE] of integer;n,i,j,max_f,ans:integer;beginassign(input,'2012C-4-1.in');reset(input);readln(n);for i:=1 to n do readln(x[i],y[i]);max_f:=0;for i:=1 to n dobeginf[i]:=0;for j:=1 to n dobeginif (x[j]<x[i]) and (y[j]<y[i]) then inc(f[i]);end;if f[i]>=max_f thenbeginmax_f:=f[i];ans:=i;end;end;for i:=1 to n do writeln(f[i]);writeln(ans);end.


0 0