- 排座椅
- 2015-08-18 20:43:44 @
var m,n,k,z,d,i,j,t:longint;
x,y,p,q,l,h,a,b:array[1..5000]of integer;
begin
read(m,n,k,z,d);
for i:=1 to d do begin
read(x[i],y[i],p[i],q[i]);
if x[i]=p[i] then begin
if y[i]<q[i] then inc(l[y[i]]) else inc(l[q[i]]);
end;
if y[i]=q[i] then begin
if x[i]<p[i] then inc(h[x[i]]) else inc(h[p[i]]);
end;
end;
for i:=1 to m do a[i]:=i;
for i:=1 to n do b[i]:=i;
for i:=1 to m-1 do
for j:=i+1 to m do
if (l[i]<l[j])or(l[i]=l[j])and(a[i]>a[j]) then begin
t:=l[i];l[i]:=l[j];l[j]:=t;
t:=a[i];a[i]:=a[j];a[j]:=t;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (h[i]<h[j])or(h[i]=h[j])and(b[i]>b[j]) then begin
t:=h[i];h[i]:=h[j];h[j]:=t;
t:=b[i];b[i]:=b[j];b[j]:=t;
end;
for i:=1 to k do write(b[i],' ');
writeln;
for i:=1 to z do write(a[i],' ');
end.