比赛 NOIP2008集训模拟4 评测结果 ATWAAATTTT
题目名称 彩色穿孔卡片 最终得分 40
用户昵称 dingding 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-13 09:44:22
显示代码纯文本
program ds;
var
   a,b:array[0..1000] of longint;
   color:array[0..1000] of boolean;
   data:array[0..100000] of longint;
   f:text;
   m,i,j,k,n:longint;
begin
   assign(f,'punch.in');
   reset(f);
   readln(f,n); m:=0;
   for i:=1 to n do begin
   readln(f,j,k); a[i]:=j; b[i]:=k;
   if b[i]>m then m:=b[i];
   end;
   fillchar(data,sizeof(data),0);
   fillchar(color,sizeof(color),true);
   for i:=1 to n do begin
   for j:=a[i] to b[i] do
   data[j]:=i;
   end;
   for i:=1 to m do
   color[data[i]]:=false;
   k:=0;
   for i:=1 to n do
   if color[i]=false then k:=k+1;
   assign(f,'punch.out');
   rewrite(f);
   writeln(f,k);
   close(f);
end.