Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.014 s | 3 KBi |
#2 |
Correcto
|
0.026 s | 6 KBi |
#3 |
Correcto
|
0.029 s | 6 KBi |
#4 |
Correcto
|
0.022 s | 3 KBi |
#5 |
Correcto
|
0.029 s | 3 KBi |
#6 |
Correcto
|
0.029 s | 3 KBi |
#7 |
Correcto
|
0.023 s | 3 KBi |
#8 |
Correcto
|
0.029 s | 4 KBi |
#9 |
Correcto
|
0.021 s | 3 KBi |
#10 |
Correcto
|
0.025 s | 7 KBi |
#11 |
Correcto
|
0.028 s | 3 KBi |
#12 |
Correcto
|
0.03 s | 3 KBi |
#13 |
Correcto
|
0.032 s | 3 KBi |
#14 |
Correcto
|
0.849 s | 85 KBi |
#15 |
Correcto
|
0.256 s | 55 KBi |
#16 |
Correcto
|
0.49 s | 37 KBi |
#17 |
Correcto
|
0.716 s | 56 KBi |
#18 |
Correcto
|
0.534 s | 37 KBi |
#19 |
Correcto
|
0.209 s | 37 KBi |
#20 |
Correcto
|
0.966 s | 116 KBi |
length = int(input()) a = input().split() # my_array = list(map(int, input().split())) my_array = [] for i in a: my_array.append(int(i)) sum_positive = 0 sum_positive_array = [] sum_negative = 0 sum_negative_array = [] cut_index = length + 1 for i in range(1, length + 1): sum_positive += my_array[i - 1] sum_negative += my_array[i * -1] sum_positive_array.append(sum_positive) sum_negative_array.append(sum_negative) if sum_negative < 0: if len(sum_positive_array) < length - i: for j in range(i, length - i): sum_positive += my_array[j] sum_positive_array.append(sum_positive) if sum_positive_array[length - i - 1] > 0: if cut_index > length - i: cut_index = length - i if cut_index == length + 1: print('Impossible') else: print(cut_index)