Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.025 s | 3 KBi |
#2 |
Correcto
|
0.023 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.027 s | 3 KBi |
#5 |
Incorrecto
|
0.027 s | 3 KBi |
#6 |
Correcto
|
0.024 s | 3 KBi |
#7 |
Correcto
|
0.03 s | 3 KBi |
#8 |
Correcto
|
0.027 s | 3 KBi |
#9 |
Correcto
|
0.028 s | 5 KBi |
#10 |
Incorrecto
|
0.023 s | 3 KBi |
#11 |
Incorrecto
|
0.025 s | 3 KBi |
#12 |
Incorrecto
|
0.024 s | 3 KBi |
#13 |
Incorrecto
|
0.024 s | 5 KBi |
#14 |
Tiempo límite excedido
|
0.243 s | 38 KBi |
#15 |
Tiempo límite excedido
|
0.222 s | 23 KBi |
#16 |
Tiempo límite excedido
|
0.238 s | 29 KBi |
#17 |
Incorrecto
|
0.4 s | 30 KBi |
#18 |
Incorrecto
|
0.348 s | 29 KBi |
#19 |
Tiempo límite excedido
|
0.225 s | 29 KBi |
#20 |
Incorrecto
|
0.391 s | 61 KBi |
n_arr = int(input()) arr = map(int, input().split(' ')) sums = [0]*(n_arr+1) positive_idxs = [] for n, p in enumerate(arr): psum = sums[n] + p sums[n+1] = psum # Narrow down to possible solutions for the left side if psum > 0: positive_idxs.append(n) if len(positive_idxs) > 0: S = sums[-1] # total sum for s_gt_zero_idx in positive_idxs: s_complement = S - sums[s_gt_zero_idx] if s_complement < 0: print(s_gt_zero_idx) break else: print('Impossible') else: print('Impossible')