讨论 / 帮看看我哪错了
9362554551 2012-07-25 03:54:00
点我顶贴 收藏 删除
program Project1;

var a,b:array[1..200000]of longint; n,m,i,k,l,j,p:longint; o:boolean;

begin

readln(n,k,p);

l:=0;

for i:=1 to n do

begin

readln(a[i],b[i]);

end;

for i:=1 to n-1 do

for j:=i+1 to n do

begin

if a[i]=a[j] then

begin

o:=false;

for k:=i to j do

if b[k]<=p then o:=true;

if o=true then inc(l);

end;

end;

write(l);

readln;

readln;

end.

通过本测试点|有效耗时172ms

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

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

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

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

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

测试结果7: 选手程序运行超过时限

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

正确结果应为:169235084

测试结果9: 选手程序运行超过时限

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

正确结果应为:399972523

求指导啊

#1 fts96@2012-07-25 03:54:00
回复 删除
这得联系你的上一个问题……

你看,你写n3算法想A明显不可能……其实有个Nk算法很容易想的……

查看更多回复
提交回复