delete pics to save space
This commit is contained in:
18
1.1540.cpp
Normal file
18
1.1540.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<cstdio>
|
||||
int n,m,x,res,l,r,a[1005],b[1005];
|
||||
int main()
|
||||
{
|
||||
scanf("%d%d",&m,&n);
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(a[x]==0)
|
||||
{
|
||||
res++;
|
||||
r++; b[r]=x; a[x]=1;
|
||||
if(r>m) l++,a[b[l]]=0;
|
||||
}
|
||||
}
|
||||
printf("%d\n",res);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user