23542023-01-10 22:43:47kristofKarácsonyi égőkpython3Time limit exceeded 30/1001.6s29772 KiB
from sys import maxsize

N, C = map(int, input().split())

L = list(map(int, input().split()))

tempL = list((0 for i in range(N)))
tempLCounter = 0
shortest = maxsize
shortestTemp = 0

for i in range(N):
    tempLCounter = 0
    tempL = list((0 for i in range(N)))
    shortestTemp = 0
    for j in range(i, N):
        shortestTemp += 1
        if int(tempL[L[j]]) == 0:
            tempL[L[j]] += 1 # type: ignore
            tempLCounter += 1
        if tempLCounter == C:
            maxsize = min(maxsize, shortestTemp)
            break

print(maxsize)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms11064 KiB
2Accepted16ms11444 KiB
subtask20/15
3Time limit exceeded1.6s9316 KiB
4Time limit exceeded1.575s9484 KiB
5Time limit exceeded1.567s9744 KiB
6Accepted287ms12256 KiB
7Accepted268ms12712 KiB
subtask310/10
8Accepted17ms12540 KiB
9Accepted17ms12780 KiB
10Accepted17ms12888 KiB
11Accepted17ms12884 KiB
12Accepted17ms13084 KiB
subtask420/20
13Accepted90ms13336 KiB
14Accepted76ms13216 KiB
15Accepted65ms13224 KiB
16Accepted98ms13224 KiB
17Accepted72ms13276 KiB
subtask50/25
18Time limit exceeded1.554s6716 KiB
19Time limit exceeded1.547s6612 KiB
20Time limit exceeded1.567s6940 KiB
21Time limit exceeded1.57s6728 KiB
22Time limit exceeded1.562s6696 KiB
subtask60/30
23Time limit exceeded1.583s28644 KiB
24Time limit exceeded1.564s25872 KiB
25Time limit exceeded1.569s28480 KiB
26Time limit exceeded1.552s29772 KiB
27Time limit exceeded1.56s29712 KiB
28Time limit exceeded1.56s28576 KiB
29Time limit exceeded1.559s25944 KiB
30Time limit exceeded1.559s11804 KiB