112572024-08-02 00:56:33probaKombináció (50)python3Time limit exceeded 1/50300ms26220 KiB
# sorrend
#sor1 = list(map(int, '6 4'.split(' '))); sorrend = '1 2 4 6'
sor1 = list(map(int, input().split(' '))); sorrend = input()

szek, diak = sor1[0], sor1[1]

def megold(lista):
    temp = []
    
    for i in lista:
        for j in range(1, szek+1):
            if j not in i and j>max(i):
                x = i+[j]
                temp += [x]
    return temp

lista = megold([[i] for i in range(1, szek+1)])

for i in range(diak-2):
    lista = megold(lista)

s = []
for i in lista:
    s += [' '.join(list(map(str, i)))]
s.sort()

print(s[s.index(sorrend)-1], s[s.index(sorrend)+1], sep='\n')


    



                        
            


SubtaskSumTestVerdictTimeMemory
base1/50
1Accepted0/017ms3088 KiB
2Time limit exceeded0/0298ms26220 KiB
3Runtime error0/217ms3104 KiB
4Runtime error0/217ms3192 KiB
5Partially correct1/219ms3064 KiB
6Runtime error0/219ms3044 KiB
7Wrong answer0/219ms3320 KiB
8Time limit exceeded0/2296ms19116 KiB
9Time limit exceeded0/2294ms21836 KiB
10Time limit exceeded0/4300ms19012 KiB
11Time limit exceeded0/4300ms21964 KiB
12Time limit exceeded0/4296ms21644 KiB
13Runtime error0/428ms3988 KiB
14Time limit exceeded0/4296ms25268 KiB
15Time limit exceeded0/4298ms25524 KiB
16Time limit exceeded0/6300ms24248 KiB
17Time limit exceeded0/6300ms26108 KiB