2756 | 2023-01-21 17:30:10 | renn | Karácsonyi égők | python3 | Wrong answer 0/100 | 351ms | 60860 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)
if egok[0] == egok[-1]:
egok.pop(0)
continue
szinek[Y] += 1
if szinek[Y] == 1:
Z += 1
while egok[0] == egok[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 | 17ms | 10952 KiB | ||||
2 | Accepted | 17ms | 11428 KiB | ||||
subtask2 | 0/15 | ||||||
3 | Wrong answer | 277ms | 15520 KiB | ||||
4 | Wrong answer | 319ms | 16308 KiB | ||||
5 | Wrong answer | 351ms | 16504 KiB | ||||
6 | Wrong answer | 17ms | 12284 KiB | ||||
7 | Wrong answer | 17ms | 12340 KiB | ||||
subtask3 | 0/10 | ||||||
8 | Accepted | 17ms | 12488 KiB | ||||
9 | Wrong answer | 17ms | 12664 KiB | ||||
10 | Wrong answer | 17ms | 13100 KiB | ||||
11 | Wrong answer | 17ms | 12984 KiB | ||||
12 | Wrong answer | 17ms | 12972 KiB | ||||
subtask4 | 0/20 | ||||||
13 | Wrong answer | 17ms | 13080 KiB | ||||
14 | Wrong answer | 17ms | 13040 KiB | ||||
15 | Wrong answer | 17ms | 13504 KiB | ||||
16 | Accepted | 17ms | 13460 KiB | ||||
17 | Wrong answer | 17ms | 13236 KiB | ||||
subtask5 | 0/25 | ||||||
18 | Accepted | 20ms | 14960 KiB | ||||
19 | Wrong answer | 19ms | 14796 KiB | ||||
20 | Wrong answer | 18ms | 14704 KiB | ||||
21 | Wrong answer | 20ms | 14384 KiB | ||||
22 | Wrong answer | 19ms | 14344 KiB | ||||
subtask6 | 0/30 | ||||||
23 | Accepted | 170ms | 60860 KiB | ||||
24 | Wrong answer | 108ms | 45872 KiB | ||||
25 | Wrong answer | 182ms | 57592 KiB | ||||
26 | Wrong answer | 155ms | 56172 KiB | ||||
27 | Wrong answer | 184ms | 59416 KiB | ||||
28 | Wrong answer | 179ms | 56356 KiB | ||||
29 | Wrong answer | 170ms | 51828 KiB | ||||
30 | Wrong answer | 172ms | 20496 KiB |