| 记录编号 | 
        17495 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        85.画展 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         郭乾乐 | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.327 s  | 
    
    
        | 提交时间 | 
        2010-07-23 16:44:15 | 
        内存使用 | 
        4.08 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<iostream>
#include<fstream>
using namespace std;
int a[1000001],n,m,head=1,tail=0,b[2001],minn=2000001,hh,tt,num=0;
void yi()
{
	if(num==m)
	{
		if(minn>tail-head+1)
		{
			minn=tail-head+1;
			hh=head;
			tt=tail;
		}
		b[a[head]]--;
		if(b[a[head]]==0) num--;
		head++;
		yi();
	}
}
int main()
{
	ifstream fin("exhibit.in");
	ofstream fout("exhibit.out");
	int i,x;
	fin>>n>>m;
	for(i=1;i<=n;i++)
	{
		fin>>x;
		a[i]=x;
		if(b[x]==0) num++;
		b[x]++;
		tail++;
		yi();
	}
	fout<<hh<<' '<<tt;
	return 0;
}