比赛 NOIP_1 评测结果 AAAAAATEEE
题目名称 画展 最终得分 60
用户昵称 zxc111 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-09-03 21:29:34
显示代码纯文本
program ooo;
var
i,j,k,n,m,x,y,min:longint;
a:array[1..100000] of longint;
b:array[1..2000] of longint;
f:boolean;
t:text;
procedure oo;
var
i:longint;
begin
f:=false;
for i:=1 to n do
if a[i]=0 then begin f:=true;exit;end;
end;
begin
min:=maxlongint;
assign(t,'exhibit.in');
reset(t);
readln(t,m,n);
for i:=1 to m do
read(t,a[i]);
close(t);
for i:=1 to m do
 begin
  j:=i;k:=0;
  fillchar(b,sizeof(b),0);
  while (j<=m)and(k<>n) do
   if b[a[j]]=0 then
   begin
    inc(k);inc(b[a[j]]);inc(j)
   end else inc(j);
  if (k=n)and(j-i<min) then begin min:=j-i;x:=i;y:=j-1;end;
 end;
 assign(t,'exhibit.out');
 rewrite(t);
write(t,x,' ',y);
close(t);
end.