General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
257152075 Practice:
Traverser_Steal69
616D - 18 C++14 (GCC 6-32) Accepted 171 ms 5928 KB 2024-04-18 12:58:05 2024-04-18 12:58:05
→ Source
#include<ios>
int c[1000005],a[500005],n,i,k,l,r,s,x,y=-1;
main(){
	for(scanf("%d%d",&n,&k),i=1;i<=n;i++)scanf("%d",a+i);
	for(l=1,r=1;r<=n;r++){
		for(s+=!c[a[r]]++;l<=r&&s>k;s-=!--c[a[l++]]);
		if(r-l>y-x)y=r,x=l;
	}
	printf("%d %d",x,y);
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details