Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Correcto
|
0.014 s | 3 KBi |
#3 |
Correcto
|
0.026 s | 3 KBi |
#4 |
Correcto
|
0.026 s | 3 KBi |
#5 |
Correcto
|
0.029 s | 3 KBi |
#6 |
Correcto
|
0.026 s | 7 KBi |
#7 |
Correcto
|
0.029 s | 3 KBi |
#8 |
Correcto
|
0.029 s | 3 KBi |
#9 |
Correcto
|
0.029 s | 3 KBi |
#10 |
Correcto
|
0.029 s | 3 KBi |
#11 |
Correcto
|
0.026 s | 3 KBi |
#12 |
Correcto
|
0.121 s | 3 KBi |
#13 |
Correcto
|
0.045 s | 7 KBi |
#14 |
Tiempo límite excedido
|
1.548 s | 32 KBi |
#15 |
Correcto
|
0.331 s | 12 KBi |
#16 |
Correcto
|
0.291 s | 28 KBi |
#17 |
Correcto
|
0.146 s | 28 KBi |
#18 |
Correcto
|
0.325 s | 27 KBi |
#19 |
Correcto
|
0.116 s | 28 KBi |
#20 |
Tiempo límite excedido
|
1.537 s | 57 KBi |
from array import array from audioop import add length = int(input()) my_array = list(map(int, input().split())) sum_positive = 0 sum_negative = 0 cut_index = length + 1 for i in range(1, length + 1): sum_positive = 0 sum_negative += my_array[i * -1] if sum_negative < 0: for j in range(0, length - i): sum_positive += my_array[j] if sum_positive > 0: if cut_index > length - i: cut_index = length - i if cut_index == length + 1: print('Impossible') else: print(cut_index)