eastpiger eastpiger
www.eastpiger.com
关注数: 15 粉丝数: 24 发帖数: 1,296 关注贴吧数: 15
求帮忙看看怎么没有ac,排座位,p党进 题目:http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Ftyvj.cpwz.cn%2FProblem_Show.asp%3Fid%3D1007&urlrefer=28e293fbf3820b5e235306bba6907291 我的代码(很多脑残的地方,请略) type int=longint; shu=array[1..1000,1..2] of int; var m,n,k,l,d,i:int; a:shu; b:shu; procedure load; var x1,x2,y1,y2:int; begin readln(x1,y1,x2,y2); if x1=x2 then begin if y2<y1 then y1:=y2; inc(b[y1,1]); exit; end; if y1=y2 then begin if x2<x1 then x1:=x2; inc(a[x1,1]); exit; end; end; procedure sort(var a:shu;r,l:int); var i,j,mid1,k1,k2:int; begin i:=r;j:=l;mid1:=a[(r+l)div 2,1]; repeat while a[i,1]>mid1 do inc(i); while a[j,1]<mid1 do dec(j); if i<=j then begin k1:=a[i,1];k2:=a[i,2]; a[i,1]:=a[j,1];a[i,2]:=a[j,2]; a[j,1]:=k1;a[j,2]:=k2; inc(i);dec(j); end; until i>j; if i<l then sort(a,i,l); if j>r then sort(a,r,j); end; procedure sort2(var a:shu;r,l:int); var i,j,mid,k1,k2:int; begin i:=r;j:=l;mid:=a[(r+l)div 2,2]; repeat while a[i,2]<mid do inc(i); while a[j,2]>mid do dec(j); if i<=j then begin k1:=a[i,2]; a[i,2]:=a[j,2]; a[j,2]:=k1; inc(i);dec(j); end; until i>j; if i<l then sort(a,i,l); if j>r then sort(a,r,j); end; begin fillchar(a,sizeof(a),0); fillchar(b,sizeof(b),0); readln(m,n,k,l,d); for i:=1 to m do a[i,2]:=i; for i:=1 to n do b[i,2]:=i; for i:=1 to d do load; sort(a,1,m); sort(b,1,n); sort2(a,1,k); sort2(b,1,l); for i:=1 to k-1 do write(a[i,2],' ');writeln(a[k,2]); for i:=1 to l-1 do write(b[i,2],' ');writeln(b[l,2]); end.
1 下一页