O(N^2)排序,按题意模拟。var n,m,i,j,t,k:longint; a,b:array[1..6000] of longint;begin readln(n,m); for i:=1 to n do readln(a[i],b[i]); for i:=1 to n-1 do for j:=i+1 to n do if b[i]<b[j] then begin t:=b[i];b[i]:=b[j];b[j]:=t; t:=a[i];a[i]:=a[j];a[j]:=t; end else if (b[i]=b[j])and(a[i]>a[j]) then begin t:=b[i];b[i]:=b[j];b[j]:=t; t:=a[i];a[i]:=a[j];a[j]:=t; end; m:=trunc(m*1.5); k:=b[m]; write(k,' '); while b[m+1]=k do inc(m); writeln(m); for j:=1 to m do writeln(a[j],' ',b[j])end.