General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
141465763 Practice:
190031554
616D - 18 PyPy 3 Accepted 452 ms 42244 KB 2022-01-03 11:31:44 2022-01-03 11:31:44
→ Source
n,k = map(int, input().split())
hash = [0]*1000001
now = 0
a = list(map(int, input().split()))
ans = 0
l = 0
 
for r in range(n):
	hash[a[r]]+=1
	if hash[a[r]] == 1: now+=1
	while (now>k):
		hash[a[l]]-=1
		if (hash[a[l]]==0): now-=1
		l+=1
	if r-l+1>ans:
		al = l
		ar = r
		ans = r-l+1
print(al+1,ar+1)
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details