110832024-07-06 16:55:15probaKarácsonyi égőkpython3Time limit exceeded 0/1001.598s28388 KiB
#egok
sor1 = input()

sor2 = input()

N = int(sor1.split(' ')[0])
C = int(sor1.split(' ')[1])
lista = [int(i) for i in sor2.split(' ')]

def vizsgal(resz):
    ok = [0]*C
    
    for i in range(C):
        if i in resz:
            ok[i] = 1
    return ok.count(1) != C

i, h = 0, C

while vizsgal(lista[i:i+h+1]) and h < N:
    if i<(N-h):
        i += 1
    else:
        i = 0
        h += 1
print(h+1)        
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted18ms3048 KiB
2Accepted17ms3044 KiB
subtask20/15
3Time limit exceeded1.593s7516 KiB
4Time limit exceeded1.588s7560 KiB
5Time limit exceeded1.593s7572 KiB
6Time limit exceeded1.593s3044 KiB
7Time limit exceeded1.598s3044 KiB
subtask30/10
8Wrong answer17ms3064 KiB
9Accepted19ms3044 KiB
10Accepted19ms2944 KiB
11Accepted20ms3044 KiB
12Accepted19ms3064 KiB
subtask40/20
13Time limit exceeded1.595s3192 KiB
14Accepted259ms3088 KiB
15Accepted65ms3032 KiB
16Time limit exceeded1.593s3044 KiB
17Accepted669ms2916 KiB
subtask50/25
18Wrong answer171ms3764 KiB
19Time limit exceeded1.595s3432 KiB
20Time limit exceeded1.588s3600 KiB
21Time limit exceeded1.592s3480 KiB
22Time limit exceeded1.598s3044 KiB
subtask60/30
23Time limit exceeded1.59s27516 KiB
24Time limit exceeded1.597s23680 KiB
25Time limit exceeded1.59s26640 KiB
26Time limit exceeded1.59s28304 KiB
27Time limit exceeded1.598s28388 KiB
28Time limit exceeded1.598s26640 KiB
29Time limit exceeded1.593s23864 KiB
30Time limit exceeded1.588s7796 KiB