这个快排用的是随机数优化,防止有些出题人卡快排
var
a:array[0..1000000] of longint;
i,j,k,n,m:longint;
procedure sort(l,r:longint);
var
i,j,mid,t:longint;
begin
if l>r then exit;
i:=l; j:=r;
mid:=a[random(r-l+1)+l];
repeat
while a[i]mid do dec(j);
if i<=j then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
inc(i); dec(j);
end;
until i>j;
if j>l then sort(l,j);
if i
Comments NOTHING