2353 | 2023-01-10 22:43:31 | kristof | Karácsonyi égők | python3 | Wrong answer 70/100 | 321ms | 60120 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 | 17ms | 11248 KiB | ||||
2 | Accepted | 17ms | 11676 KiB | ||||
subtask2 | 15/15 | ||||||
3 | Accepted | 282ms | 18336 KiB | ||||
4 | Accepted | 263ms | 18376 KiB | ||||
5 | Accepted | 277ms | 18568 KiB | ||||
6 | Accepted | 17ms | 12272 KiB | ||||
7 | Accepted | 17ms | 12692 KiB | ||||
subtask3 | 10/10 | ||||||
8 | Accepted | 17ms | 12508 KiB | ||||
9 | Accepted | 17ms | 12628 KiB | ||||
10 | Accepted | 17ms | 12732 KiB | ||||
11 | Accepted | 17ms | 12960 KiB | ||||
12 | Accepted | 16ms | 12880 KiB | ||||
subtask4 | 20/20 | ||||||
13 | Accepted | 17ms | 13332 KiB | ||||
14 | Accepted | 17ms | 13364 KiB | ||||
15 | Accepted | 17ms | 13460 KiB | ||||
16 | Accepted | 17ms | 13908 KiB | ||||
17 | Accepted | 17ms | 13516 KiB | ||||
subtask5 | 25/25 | ||||||
18 | Accepted | 23ms | 14644 KiB | ||||
19 | Accepted | 24ms | 14620 KiB | ||||
20 | Accepted | 24ms | 14644 KiB | ||||
21 | Accepted | 25ms | 14524 KiB | ||||
22 | Accepted | 24ms | 14348 KiB | ||||
subtask6 | 0/30 | ||||||
23 | Wrong answer | 244ms | 58024 KiB | ||||
24 | Accepted | 209ms | 52752 KiB | ||||
25 | Accepted | 232ms | 57944 KiB | ||||
26 | Accepted | 237ms | 60120 KiB | ||||
27 | Accepted | 228ms | 60108 KiB | ||||
28 | Accepted | 224ms | 57740 KiB | ||||
29 | Accepted | 321ms | 52744 KiB | ||||
30 | Accepted | 216ms | 20800 KiB |