Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.024 s | 3 KBi |
#2 |
Correcto
|
0.033 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.026 s | 3 KBi |
#5 |
Correcto
|
0.025 s | 3 KBi |
#6 |
Correcto
|
0.026 s | 3 KBi |
#7 |
Correcto
|
0.026 s | 3 KBi |
#8 |
Correcto
|
0.131 s | 4 KBi |
#9 |
Tiempo límite excedido
|
0.815 s | 9 KBi |
#10 |
Correcto
|
0.588 s | 9 KBi |
#11 |
Correcto
|
0.556 s | 9 KBi |
#12 |
Correcto
|
0.588 s | 9 KBi |
#13 |
Tiempo límite excedido
|
0.888 s | 9 KBi |
#14 |
Correcto
|
0.929 s | 9 KBi |
n = int(input()) array = list(map(int, input().split())) kadane = [] cases = int(input()) total = 0 for i in range(n): total+=array[i] kadane.append(total) for _ in range(cases): p, q = list(map(int, input().split())) if p == q: print(array[p]) elif p == 0: print(kadane[q]) else: print(kadane[q] - kadane[p-1])