Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.024 s | 3 KBi |
#2 |
Correcto
|
0.028 s | 3 KBi |
#3 |
Correcto
|
0.021 s | 3 KBi |
#4 |
Correcto
|
0.028 s | 3 KBi |
#5 |
Correcto
|
0.023 s | 3 KBi |
#6 |
Correcto
|
0.018 s | 3 KBi |
#7 |
Correcto
|
0.022 s | 4 KBi |
#8 |
Correcto
|
0.018 s | 3 KBi |
#9 |
Correcto
|
0.025 s | 3 KBi |
#10 |
Correcto
|
0.027 s | 7 KBi |
#11 |
Correcto
|
0.01 s | 3 KBi |
#12 |
Correcto
|
0.084 s | 3 KBi |
#13 |
Correcto
|
0.062 s | 4 KBi |
#14 |
Tiempo límite excedido
|
1.558 s | 33 KBi |
#15 |
Correcto
|
0.545 s | 12 KBi |
#16 |
Correcto
|
0.39 s | 28 KBi |
#17 |
Correcto
|
0.55 s | 27 KBi |
#18 |
Correcto
|
0.393 s | 28 KBi |
#19 |
Correcto
|
0.408 s | 27 KBi |
#20 |
Tiempo límite excedido
|
1.547 s | 57 KBi |
from array import array from audioop import add 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_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)