比赛 NOIP2008集训模拟4 评测结果 AEWAWAEEEE
题目名称 彩色穿孔卡片 最终得分 30
用户昵称 zpl123 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-13 08:38:04
显示代码纯文本
program punch;
type
t1=array[0..100000] of longint;
t2=array[1..10000] of longint;

var
n,max,max1:longint;
x:t1;
color:t2;

procedure init;
begin
assign(input,'punch.in');
reset(input);
assign(output,'punch.out');
rewrite(output);
readln(n);
max:=0;
end;

function judge(w:longint):boolean;
var
i:longint;
begin
judge:=false;
for i:=1 to max1 do if w=color[i] then exit(true);
end;

procedure main;
var
i,j,x1,y1:longint;
begin
for i:=1 to n do
 begin
 readln(x1,y1);
 if y1>=max then max:=y1;
 for j:=x1 to y1 do x[j]:=i;
 end;
for i:=1 to max do
 if (not judge(x[i])) then
  begin
  inc(max1);
  color[max1]:=x[i];
  end;
end;

procedure print;
begin
writeln(max1);
close(input);
close(output);
end;

begin
init;
main;
print;
end.