Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.024 s | 3 KBi |
#2 |
Incorrecto
|
0.022 s | 3 KBi |
#3 |
Incorrecto
|
0.037 s | 5 KBi |
#4 |
Correcto
|
0.028 s | 6 KBi |
#5 |
Incorrecto
|
0.023 s | 3 KBi |
#6 |
Correcto
|
0.028 s | 3 KBi |
#7 |
Correcto
|
0.031 s | 4 KBi |
#8 |
Correcto
|
0.028 s | 7 KBi |
#9 |
Correcto
|
0.03 s | 3 KBi |
#10 |
Incorrecto
|
0.035 s | 7 KBi |
#11 |
Incorrecto
|
0.028 s | 5 KBi |
#12 |
Incorrecto
|
0.025 s | 3 KBi |
#13 |
Incorrecto
|
0.029 s | 3 KBi |
#14 |
Tiempo límite excedido
|
0.531 s | 47 KBi |
#15 |
Incorrecto
|
0.489 s | 33 KBi |
#16 |
Correcto
|
0.505 s | 31 KBi |
#17 |
Tiempo límite excedido
|
0.393 s | 29 KBi |
#18 |
Incorrecto
|
0.426 s | 29 KBi |
#19 |
Tiempo límite excedido
|
0.464 s | 31 KBi |
#20 |
Tiempo límite excedido
|
0.436 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) break if flag: print("Impossible")