2021-06-28 20:15:35 +02:00
|
|
|
from typing import List
|
|
|
|
import sys
|
|
|
|
|
|
|
|
input_values: List[str] = []
|
|
|
|
for value in sys.stdin:
|
|
|
|
input_values.append(value.rstrip('\n'))
|
|
|
|
|
|
|
|
|
2021-06-29 17:35:54 +02:00
|
|
|
def consecutive_numbers(numbers: List[int], couple_length: int) -> List[List[int]]:
|
|
|
|
result: List[List[int]] = []
|
2021-06-28 20:15:35 +02:00
|
|
|
numbers_length = len(numbers)
|
|
|
|
for index in range(numbers_length):
|
2021-06-29 17:35:54 +02:00
|
|
|
consecutive: List[int] = [numbers[index]]
|
|
|
|
for couple_index in range(1, couple_length, 1):
|
|
|
|
is_last_number = index + couple_index == numbers_length
|
|
|
|
if is_last_number:
|
|
|
|
break
|
|
|
|
if (numbers[index] + couple_index == numbers[index + couple_index]):
|
|
|
|
consecutive.append(numbers[index] + couple_index)
|
|
|
|
is_consecutive = len(consecutive) == couple_length
|
|
|
|
if is_consecutive:
|
|
|
|
result.append(consecutive)
|
|
|
|
return result
|
2021-06-28 20:15:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
numbers: List[int] = []
|
2021-06-29 17:35:54 +02:00
|
|
|
for value in input_values[1].split(' ; '):
|
2021-06-28 20:15:35 +02:00
|
|
|
numbers.append(int(value))
|
|
|
|
|
2021-06-29 17:35:54 +02:00
|
|
|
result = consecutive_numbers(numbers, int(input_values[0]))
|
|
|
|
for consecutive in result:
|
|
|
|
consecutive = [str(number) for number in consecutive]
|
|
|
|
print(' ; '.join(consecutive))
|