Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.019 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.026 s | 3 KBi |
#4 |
Incorrecto
|
0.02 s | 3 KBi |
#5 |
Incorrecto
|
0.02 s | 3 KBi |
#6 |
Incorrecto
|
0.016 s | 3 KBi |
#7 |
Incorrecto
|
0.02 s | 3 KBi |
#8 |
Incorrecto
|
0.022 s | 3 KBi |
#9 |
Incorrecto
|
0.029 s | 3 KBi |
#10 |
Incorrecto
|
0.02 s | 3 KBi |
#11 |
Incorrecto
|
0.016 s | 3 KBi |
#12 |
Incorrecto
|
0.022 s | 3 KBi |
#13 |
Incorrecto
|
0.023 s | 3 KBi |
#14 |
Incorrecto
|
0.691 s | 48 KBi |
#15 |
Incorrecto
|
0.583 s | 42 KBi |
#16 |
Incorrecto
|
0.555 s | 29 KBi |
#17 |
Incorrecto
|
0.741 s | 30 KBi |
#18 |
Incorrecto
|
0.724 s | 30 KBi |
#19 |
Incorrecto
|
0.585 s | 29 KBi |
#20 |
Incorrecto
|
0.782 s | 66 KBi |
n = input() n = int(n) array_input = input() array = [int(x) for x in array_input.split()] left = array right = array[::-1] b_left = [] b_right = [] j = n - 1 for i in range(0, n): if i == 0: left[i] = array[i] else: left[i] = left[i] + left[i-1] right[i] = right[i] + right[i-1] if left[i] > 0: b_left.append(i) if right[i] < 0: b_right.append(j) j -= 1 b_right = b_right[::-1] if b_right and b_left: c = 0 while c < len(b_right): if b_right[c] in b_left: print(b_right[c]) exit() else: print('Impossible') exit() c += 1 else: print('Impossible') print(b_left) print(b_right)