讨论 / 为什么总是WA70!!求帮看哪里错了!!!!!!
Biuuuuuuuu 2013-08-26 22:16:00
点我顶贴 收藏 删除
program taotao;

var n,m,i,s,j:integer;

hn,hm:array[1..2000]of integer;

procedure qs(l,r:integer);

var mid,t:integer;

begin

i:=l; j:=r;

mid:=(i+j) div 2;

repeat

while hm[i]<hm[mid] do inc(i);

while hm[j]>hm[mid] do dec(j);

if i<=j then begin

t:=hm[i];

hm[i]:=hm[j];

hm[j]:=t;

inc(i); dec(j);

end;

until i>j;

if i<r then qs(i,r);

if j>l then qs(l,j);

end;

begin

read(n);readln(m);

for i:=1 to n do

readln(hn[i]);

for i:=1 to m do

readln(hm[i]);

qs(1,m);

s:=m;

for i:=1 to n do

for j:= m downto 1 do

if hm[j]<>0 then

if hn[i]>hm[j] then

begin

dec(s);

hm[j]:=0;

break;

end;

write(s);

end.

测试结果1: 通过本测试点|有效耗时187ms

测试结果2: 通过本测试点|有效耗时172ms

测试结果3: 测试结果错误.错误结果为:10

正确结果应为:8

测试结果4: 通过本测试点|有效耗时172ms

测试结果5: 通过本测试点|有效耗时172ms

测试结果6: 通过本测试点|有效耗时171ms

测试结果7: 测试结果错误.错误结果为:35

正确结果应为:24

测试结果8: 测试结果错误.错误结果为:42

正确结果应为:37

测试结果9: 通过本测试点|有效耗时172ms

测试结果10: 通过本测试点|有效耗时172ms

#1 whxc049@2015-02-12 06:15:22
回复 删除
0没去

查看更多回复
提交回复