| 比赛 | 
    NOIP_1 | 
    评测结果 | 
    AAAATTTTTT | 
    | 题目名称 | 
    画展 | 
    最终得分 | 
    40 | 
    | 用户昵称 | 
    nick09 | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    Pascal | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2010-07-23 11:01:48 | 
显示代码纯文本
program exhibit;
var
  a:array[1..1000000]of integer;//du ru
  p:array[1..2000]of boolean;//cun zai
  a1,a2,n,m,head,tail,total,tl:longint;//
  f1,f2:text;
procedure init;
var i:longint;
begin
 assign(f1,'exhibit.in');reset(f1);
 assign(f2,'exhibit.out');rewrite(f2);
 readln(f1,n,m);
 for i:=1 to n do read(f1,a[i]);
end;
procedure go;
var i,j:longint;
    fg,fg2:boolean;
begin
 fg2:=true;
 repeat
  if tail-head+1>tl then begin break;fg2:=false;end;
  fillchar(p,sizeof(p),false);
  for i:=head to tail do p[a[i]]:=true;
  fg:=true;
  for i:=1 to m do if not p[i] then begin fg:=false;break;end;
  if not fg then inc(tail);
 until fg;
 if( fg2) and( tl>tail-head+1) then
          begin tl:=tail-head+1;
          a1:=head;a2:=tail; end;
end;
Begin
init;
head:=1;  total:=0;
tl:=1000000;    tail:=head+m-1;
repeat
 go;
 inc(head);
 tail:=head+m-1;
until head>=n-m;
writeln(f2,a1,' ',a2);
close(f1);close(f2);
end.