112582024-08-02 01:00:51probaKombináció (50)python3Time limit exceeded 4/50300ms26036 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)))]


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


    



                        
            


SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/018ms3088 KiB
2Time limit exceeded0/0300ms24416 KiB
3Runtime error0/218ms2952 KiB
4Runtime error0/218ms3088 KiB
5Accepted2/220ms3044 KiB
6Runtime error0/219ms3188 KiB
7Accepted2/220ms3048 KiB
8Time limit exceeded0/2298ms18904 KiB
9Time limit exceeded0/2296ms21368 KiB
10Time limit exceeded0/4298ms18960 KiB
11Time limit exceeded0/4300ms21964 KiB
12Time limit exceeded0/4296ms21368 KiB
13Runtime error0/428ms3812 KiB
14Time limit exceeded0/4296ms25716 KiB
15Time limit exceeded0/4298ms25684 KiB
16Time limit exceeded0/6298ms24120 KiB
17Time limit exceeded0/6300ms26036 KiB