li = [-1, -1, 2, 2, -1, 1, 1, 1, 1, 1, -1, -1]

def sub_seq(li, n):
    res = defaultdict(list)
for k, g in groupby(enumerate(li), itemgetter(1)):
    l = list(map(itemgetter(0), g))
if n <= len(l):
    res[k] += l[0:len(l) - n + 1]
return res
for i in (5, 4, 3, 2):
    pass
Sequence of elements in a list satisfying a condition