Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Incorrecto
|
0.023 s | 3 KBi |
#3 |
Incorrecto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 5 KBi |
#5 |
Incorrecto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.026 s | 3 KBi |
#7 |
Correcto
|
0.025 s | 3 KBi |
#8 |
Correcto
|
0.033 s | 7 KBi |
#9 |
Correcto
|
0.025 s | 3 KBi |
#10 |
Correcto
|
0.025 s | 3 KBi |
#11 |
Correcto
|
0.029 s | 6 KBi |
#12 |
Correcto
|
0.031 s | 3 KBi |
#13 |
Correcto
|
0.033 s | 3 KBi |
#14 |
Tiempo límite excedido
|
0.343 s | 35 KBi |
#15 |
Incorrecto
|
0.635 s | 33 KBi |
#16 |
Tiempo límite excedido
|
0.373 s | 29 KBi |
#17 |
Tiempo límite excedido
|
0.291 s | 29 KBi |
#18 |
Tiempo límite excedido
|
0.355 s | 29 KBi |
#19 |
Tiempo límite excedido
|
0.345 s | 29 KBi |
#20 |
Tiempo límite excedido
|
0.362 s | 57 KBi |
n = int(input()) nums = list(map(int, input().split())) left = [0 for x in range(n)] right = [0 for x in range(n)] left[0] = nums[0] right[0] = nums[n - 1] for i in range(1, n): left[i] = left[i - 1] + nums[i] for i in reversed(range(n - 2)): right[i] = right[i + 1] + nums[i] flag = True for i in range(n - 1): if left[i] > 0 and right[i + 1] < 0: print(i + 1) flag = False break if flag: print("Impossible")