2758 | 2023-01-21 17:36:10 | renn | Karácsonyi égők | python3 | Accepted 100/100 | 1.149s | 62396 KiB |
sor = input().split()
N = int(sor[0])
C = int(sor[1])
sor = input().split()
def megold():
egok = []
szinek = [0 for i in range(0, C)]
global Y
global Z
Y = 0
Z = 0
for X in range(0, C):
Y = int(sor[X])
szinek[Y] += 1
egok.append(Y)
if szinek[Y] == 1:
Z += 1
if Z == C:
print(C)
return
for X in range(C, N):
Y = int(sor[X])
egok.append(Y)
szinek[Y] += 1
if szinek[Y] == 1:
Z += 1
while szinek[egok[0]] > 1:
szinek[egok[0]] -= 1
if szinek[egok[0]] == 0:
Z -= 1
egok.pop(0)
if Z == C:
print(len(egok))
return
megold()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11284 KiB | ||||
2 | Accepted | 17ms | 11856 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 119ms | 16480 KiB | ||||
4 | Accepted | 149ms | 16856 KiB | ||||
5 | Accepted | 159ms | 16916 KiB | ||||
6 | Accepted | 17ms | 12668 KiB | ||||
7 | Accepted | 17ms | 12588 KiB | ||||
subtask3 | 10/10 | ||||||
8 | Accepted | 17ms | 12500 KiB | ||||
9 | Accepted | 17ms | 12640 KiB | ||||
10 | Accepted | 17ms | 12860 KiB | ||||
11 | Accepted | 17ms | 13120 KiB | ||||
12 | Accepted | 17ms | 13292 KiB | ||||
subtask4 | 20/20 | ||||||
13 | Accepted | 17ms | 13380 KiB | ||||
14 | Accepted | 17ms | 13536 KiB | ||||
15 | Accepted | 17ms | 13780 KiB | ||||
16 | Accepted | 17ms | 14152 KiB | ||||
17 | Accepted | 17ms | 14232 KiB | ||||
subtask5 | 25/25 | ||||||
18 | Accepted | 19ms | 15240 KiB | ||||
19 | Accepted | 20ms | 14872 KiB | ||||
20 | Accepted | 18ms | 14960 KiB | ||||
21 | Accepted | 21ms | 14504 KiB | ||||
22 | Accepted | 20ms | 14136 KiB | ||||
subtask6 | 30/30 | ||||||
23 | Accepted | 179ms | 60968 KiB | ||||
24 | Accepted | 107ms | 45692 KiB | ||||
25 | Accepted | 195ms | 56992 KiB | ||||
26 | Accepted | 1.149s | 56312 KiB | ||||
27 | Accepted | 241ms | 62396 KiB | ||||
28 | Accepted | 203ms | 56072 KiB | ||||
29 | Accepted | 252ms | 45296 KiB | ||||
30 | Accepted | 146ms | 21400 KiB |