2757 | 2023-01-21 17:33:32 | renn | Karácsonyi égők | python3 | Wrong answer 0/100 | 1.572s | 60380 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] > 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 | Wrong answer | 17ms | 11204 KiB | ||||
2 | Wrong answer | 17ms | 11280 KiB | ||||
subtask2 | 0/15 | ||||||
3 | Wrong answer | 328ms | 15764 KiB | ||||
4 | Wrong answer | 736ms | 16116 KiB | ||||
5 | Wrong answer | 345ms | 16508 KiB | ||||
6 | Wrong answer | 17ms | 12228 KiB | ||||
7 | Wrong answer | 17ms | 12408 KiB | ||||
subtask3 | 0/10 | ||||||
8 | Accepted | 17ms | 12604 KiB | ||||
9 | Wrong answer | 17ms | 12212 KiB | ||||
10 | Wrong answer | 17ms | 12648 KiB | ||||
11 | Accepted | 17ms | 12816 KiB | ||||
12 | Wrong answer | 17ms | 12660 KiB | ||||
subtask4 | 0/20 | ||||||
13 | Wrong answer | 17ms | 12804 KiB | ||||
14 | Wrong answer | 17ms | 12976 KiB | ||||
15 | Wrong answer | 17ms | 12884 KiB | ||||
16 | Wrong answer | 17ms | 12864 KiB | ||||
17 | Wrong answer | 17ms | 12968 KiB | ||||
subtask5 | 0/25 | ||||||
18 | Accepted | 21ms | 14300 KiB | ||||
19 | Runtime error | 18ms | 13900 KiB | ||||
20 | Runtime error | 17ms | 13928 KiB | ||||
21 | Wrong answer | 21ms | 14020 KiB | ||||
22 | Wrong answer | 19ms | 13652 KiB | ||||
subtask6 | 0/30 | ||||||
23 | Accepted | 180ms | 60380 KiB | ||||
24 | Wrong answer | 1.199s | 45452 KiB | ||||
25 | Wrong answer | 1.202s | 51140 KiB | ||||
26 | Wrong answer | 305ms | 54564 KiB | ||||
27 | Time limit exceeded | 1.572s | 26548 KiB | ||||
28 | Runtime error | 50ms | 44828 KiB | ||||
29 | Wrong answer | 1.001s | 45960 KiB | ||||
30 | Wrong answer | 171ms | 20052 KiB |