Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.025 s | 3 KBi |
#2 |
Correcto
|
0.021 s | 3 KBi |
#3 |
Correcto
|
0.021 s | 3 KBi |
#4 |
Correcto
|
0.019 s | 3 KBi |
#5 |
Incorrecto
|
0.019 s | 3 KBi |
#6 |
Correcto
|
0.021 s | 3 KBi |
#7 |
Correcto
|
0.02 s | 3 KBi |
#8 |
Correcto
|
0.016 s | 3 KBi |
#9 |
Correcto
|
0.019 s | 3 KBi |
#10 |
Incorrecto
|
0.029 s | 3 KBi |
#11 |
Incorrecto
|
0.021 s | 3 KBi |
#12 |
Incorrecto
|
0.023 s | 3 KBi |
#13 |
Incorrecto
|
0.028 s | 3 KBi |
#14 |
Incorrecto
|
0.665 s | 48 KBi |
#15 |
Incorrecto
|
0.645 s | 42 KBi |
#16 |
Correcto
|
0.696 s | 29 KBi |
#17 |
Incorrecto
|
0.677 s | 30 KBi |
#18 |
Incorrecto
|
0.545 s | 29 KBi |
#19 |
Incorrecto
|
0.554 s | 29 KBi |
#20 |
Incorrecto
|
0.688 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]) break else: print('Impossible') break c += 1 else: print('Impossible')