讨论 / 请问哪里错了!?
woshitoupi 2013-10-11 07:32:00
点我顶贴 收藏 删除
测试结果1: 通过本测试点|有效耗时172ms

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

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

测试结果4: 测试结果错误.错误结果为:143 正确结果应为:99

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

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

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

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

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

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

const

maxn=100;

var

map:array [1..maxn,1..2] of longint;

h:array [1..2] of longint;

n,i,j,t,w,k,m,g:longint;

begin

read(n,m);

for i:=1 to m do

begin

read(map[i,1],map[i,2]);

if map[i,1]>map[i,2] then

begin

g:=map[i,1];

map[i,1]:=map[i,2];

map[i,2]:=g;

end;

end;

for i:=1 to m-1 do

for j:=i+1 to m do

begin

if map[i,1]>map[j,1] then

begin

h:=map[i];

map[i]:=map[j];

map[j]:=h;

end;

end;

inc(n);

i:=1;

while m>=i do

begin

j:=i+1;

k:=0;

t:=map[i,1];

w:=map[i,2];

while (map[j,1]<=w) and (j<m) do

begin

if map[j,2]>w then w:=map[j,2];

inc(j);

k:=1;

end;

dec(n,w-t+1);

if k=1 then i:=j+1

else i:=j;

end;

writeln(n);

end.

#1 huangxin@2013-02-02 03:48:00
回复 删除
搞那么复杂干嘛

var

l,m,i,j,a,b,s:integer;

c:array[0..10000]of boolean;

begin

readln(l,m);

for i:=1 to m do

begin

readln(a,b);

for j:=a to b do c[j]:=true;

end;

for i:=0 to l do

if not c[i] then inc(s);

writeln(s);

end.

#2 huangxin@2013-02-02 03:48:00
回复 删除
搞那么复杂干嘛

var

l,m,i,j,a,b,s:integer;

c:array[0..10000]of boolean;

begin

readln(l,m);

for i:=1 to m do

begin

readln(a,b);

for j:=a to b do c[j]:=true;

end;

for i:=0 to l do

if not c[i] then inc(s);

writeln(s);

end.

#3 wanglichao@2013-04-30 05:26:00
回复 删除
可怜啊~

你没有错,数据出错!(样例都是错的!!)

#4 yumaosheng@2013-10-11 07:32:00
回复 删除
回复 沙发huangxin 的帖子

超时,超时!!!

#5 GJF2014@2014-08-24 18:24:39
回复 删除
真的?回复 #3 wanglichao:
查看更多回复
提交回复