Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.027 s | 4 KBi |
#3 |
Correcto
|
0.032 s | 3 KBi |
#4 |
Correcto
|
0.025 s | 3 KBi |
#5 |
Incorrecto
|
0.024 s | 3 KBi |
#6 |
Correcto
|
0.036 s | 3 KBi |
#7 |
Correcto
|
0.034 s | 3 KBi |
#8 |
Correcto
|
0.025 s | 4 KBi |
#9 |
Correcto
|
0.031 s | 3 KBi |
#10 |
Incorrecto
|
0.027 s | 3 KBi |
#11 |
Incorrecto
|
0.038 s | 4 KBi |
#12 |
Incorrecto
|
0.033 s | 4 KBi |
#13 |
Incorrecto
|
0.03 s | 3 KBi |
#14 |
Tiempo límite excedido
|
0.342 s | 33 KBi |
#15 |
Tiempo límite excedido
|
0.289 s | 12 KBi |
#16 |
Tiempo límite excedido
|
0.274 s | 29 KBi |
#17 |
Tiempo límite excedido
|
0.399 s | 28 KBi |
#18 |
Tiempo límite excedido
|
0.573 s | 28 KBi |
#19 |
Tiempo límite excedido
|
1.05 s | 28 KBi |
#20 |
Tiempo límite excedido
|
1.026 s | 58 KBi |
import math n = int(input()) numbers = [int(number) for number in input().split()] assert len(numbers) == n right_side_sum = [] left_side_sum = [] for i in range(n): previous_left = 0 if i - 1 < 0 else left_side_sum[i-1] previous_right = 0 if n - i == n else right_side_sum[0] left_side_sum.append(previous_left + numbers[i]) right_side_sum.insert(0, previous_right + numbers[-(i+1)]) split_number = -1 for i in range(n): if right_side_sum[i] < 0 and left_side_sum[i] > 0: split_number = i break if split_number == -1: print("Impossible") else: print(split_number)