测评机: Xeond[6]
得分: 80分
提交日期: 2010-8-9 20:59:00
有效耗时: 1609毫秒
测试结果1: 通过本测试点|有效耗时203ms
测试结果2: 通过本测试点|有效耗时172ms
测试结果3: 通过本测试点|有效耗时187ms
测试结果4: 通过本测试点|有效耗时188ms
测试结果5: 通过本测试点|有效耗时172ms
测试结果6: 通过本测试点|有效耗时172ms
测试结果7: 通过本测试点|有效耗时265ms
测试结果8: 通过本测试点|有效耗时250ms
测试结果9: 运行错误|栈溢出
测试结果10: 运行错误|栈溢出
program p350;
type arr=array[1..10000]of longint;
var n,m,ii,i,j,k,jj:longint;
a,c:arr;
procedure kuai(s,t:integer);
var i,j,x,t1,y:longint;
begin
i:=s;j:=t;x:=a[i];y:=c[i];
repeat
while (a[j]>=x) and (j>i) do j:=j-1;
if j>i then begin t1:=a[i];a[i]:=a[j];a[j]:=t1;t1:=c[i];c[i]:=c[j];c[j]:=t1;end;
while (a[i]<=x) and (i<j) do i:=i+1;
if i<j then begin t1:=a[j]; a[j]:=a[i];a[i]:=t1;t1:=c[j];c[j]:=c[i];c[i]:=t1; end
until i=j;
a[i]:=x;c[i]:=y;
i:=i+1;j:=j-1;
if s<j then kuai(s,j);
if i<t then kuai(i,t);
end;
begin
readln(n,m);
for ii:=1 to n do begin read(a[ii]);c[ii]:=ii; end;
kuai(1,n);
for ii:=1 to m do
begin
readln(i,j,k); jj:=0;
repeat inc(jj);if (c[jj]<=j)and(c[jj]>=i) then dec(k); until k=0;
writeln(a[jj]);
end;
readln;
end.
谁知道为什么!郁闷!汗。。。。
望大家看看问题出在哪!
//如果向缓冲区中写入超过其本身长度的数据,以致于缓冲区无法容纳,就会造成缓冲区以外的存储单元被改写,这种现象就称为缓冲区溢出。//
栈溢出就是缓冲区溢出的一种。
//我认为你的变量应当设置大一点。。。。//