哪错了

var
n,i,j,e,w,r,t,q,l:longint;
a,b,c,d:array[-10000..1000] of longint;
begin
read(n);
for i:=1 to n do
begin
read(a[i],b[i]);
if e>a[i] then e:=a[i];
if w<a[i] then w:=a[i];
if t>a[i] then t:=a[i];
if r<a[i] then r:=a[i];
end;
for i:=t to r do
for j:=e to w do
begin
for l:= 1 to n do
if a[l]=j then
if b[l]>i then c[j]:=b[l]-i
else c[j]:=i-b[l];

d[i]:=d[i]+c[j];
c[j]:=0;
end;
q:=d[t];
for i:=t+1 to r do
if (d[i]<q)and(d[i]>0) then q:=d[i];
writeln(q);
end.

0 条评论

目前还没有评论...

信息

ID
1691
难度
3
分类
其他 | 排序贪心 点击显示
标签
(无)
递交数
3915
已通过
1841
通过率
47%
被复制
15
上传者