62372023-11-08 12:28:00SzorenyiZalanAndrasKarácsonyi égőkpython3Wrong answer 0/1001.6s57636 KiB
def main():
    n,l=map(int,input().split())
    egok=list(map(int,input().split()))
    kezd=0
    veg=1
    mo=99999999999999
    van=[]
    a=[]
    for i in range(l):
        a.append(i)
    
    
    a.remove(egok[0])
    if (egok[1] in van):
        a.remove(egok[1])

    van=a
    while kezd<n and veg<n:
        if (egok[veg] in van):
            van.remove(egok[veg])
        
        if egok[kezd]==egok[veg] and veg!=kezd:
            kezd+=1
        else:
            veg+=1
        if len(van)==0 and veg-kezd<mo:
            mo=veg-kezd
            van.append(egok[kezd])
            kezd+=1
        

    print(mo)





main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms10944 KiB
2Accepted17ms11236 KiB
subtask20/15
3Wrong answer148ms19308 KiB
4Accepted181ms19580 KiB
5Accepted182ms19848 KiB
6Wrong answer17ms11788 KiB
7Wrong answer17ms12068 KiB
subtask30/10
8Accepted18ms12376 KiB
9Wrong answer17ms12448 KiB
10Wrong answer17ms12428 KiB
11Accepted17ms12584 KiB
12Wrong answer17ms12600 KiB
subtask40/20
13Wrong answer17ms12832 KiB
14Wrong answer17ms12964 KiB
15Accepted17ms12828 KiB
16Accepted18ms13068 KiB
17Wrong answer17ms13036 KiB
subtask50/25
18Accepted221ms14300 KiB
19Wrong answer24ms14108 KiB
20Wrong answer25ms14192 KiB
21Wrong answer20ms13764 KiB
22Accepted21ms13424 KiB
subtask60/30
23Time limit exceeded1.6s28108 KiB
24Wrong answer150ms51972 KiB
25Wrong answer192ms57484 KiB
26Time limit exceeded1.56s29896 KiB
27Time limit exceeded1.541s29944 KiB
28Wrong answer195ms57636 KiB
29Wrong answer137ms52480 KiB
30Wrong answer128ms22136 KiB