2294 | 2023-01-09 20:05:43 | neszbal | Karácsonyi égők | python3 | Wrong answer 70/100 | 331ms | 59592 KiB |
N, C = map(int, input().strip().split())
L = list(map(int, input().strip().split()))
minTav = 2e5
nyilvantartoLista = [0 for i in range(C+1)]
mostTav = 0
mostTavRovidites = 0
benneVanSzam = 0
for i in range(N):
while mostTav < N and benneVanSzam < C:
if nyilvantartoLista[L[mostTav]] == 0:
benneVanSzam += 1
nyilvantartoLista[L[mostTav]] += 1
mostTav += 1
if benneVanSzam == C:
minTav = min(minTav, mostTav - mostTavRovidites)
while mostTavRovidites < mostTav and benneVanSzam == C:
nyilvantartoLista[L[mostTavRovidites]] -= 1
if nyilvantartoLista[L[mostTavRovidites]] == 0:
benneVanSzam -= 1
mostTavRovidites += 1
if benneVanSzam == C:
minTav = min(minTav, mostTav - mostTavRovidites)
print(minTav)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11136 KiB | ||||
2 | Accepted | 17ms | 11428 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 266ms | 17792 KiB | ||||
4 | Accepted | 273ms | 18024 KiB | ||||
5 | Accepted | 266ms | 18340 KiB | ||||
6 | Accepted | 18ms | 12136 KiB | ||||
7 | Accepted | 17ms | 12436 KiB | ||||
subtask3 | 10/10 | ||||||
8 | Accepted | 17ms | 12632 KiB | ||||
9 | Accepted | 17ms | 12492 KiB | ||||
10 | Accepted | 17ms | 12600 KiB | ||||
11 | Accepted | 17ms | 12828 KiB | ||||
12 | Accepted | 17ms | 12744 KiB | ||||
subtask4 | 20/20 | ||||||
13 | Accepted | 17ms | 12820 KiB | ||||
14 | Accepted | 17ms | 12956 KiB | ||||
15 | Accepted | 17ms | 13064 KiB | ||||
16 | Accepted | 17ms | 13296 KiB | ||||
17 | Accepted | 17ms | 13296 KiB | ||||
subtask5 | 25/25 | ||||||
18 | Accepted | 21ms | 14364 KiB | ||||
19 | Accepted | 24ms | 14280 KiB | ||||
20 | Accepted | 21ms | 14280 KiB | ||||
21 | Accepted | 24ms | 13800 KiB | ||||
22 | Accepted | 23ms | 13324 KiB | ||||
subtask6 | 0/30 | ||||||
23 | Wrong answer | 246ms | 57092 KiB | ||||
24 | Accepted | 216ms | 51648 KiB | ||||
25 | Accepted | 219ms | 57260 KiB | ||||
26 | Accepted | 238ms | 59516 KiB | ||||
27 | Accepted | 231ms | 59592 KiB | ||||
28 | Accepted | 226ms | 57084 KiB | ||||
29 | Accepted | 331ms | 52196 KiB | ||||
30 | Accepted | 214ms | 19892 KiB |