Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.027 s | 3 KBi |
#2 |
Correcto
|
0.025 s | 3 KBi |
#3 |
Correcto
|
0.034 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 3 KBi |
#5 |
Correcto
|
0.029 s | 3 KBi |
#6 |
Correcto
|
0.032 s | 3 KBi |
#7 |
Correcto
|
0.023 s | 3 KBi |
#8 |
Correcto
|
0.078 s | 5 KBi |
#9 |
Correcto
|
0.41 s | 15 KBi |
#10 |
Correcto
|
0.367 s | 15 KBi |
#11 |
Correcto
|
0.395 s | 15 KBi |
#12 |
Correcto
|
0.318 s | 15 KBi |
#13 |
Correcto
|
0.361 s | 17 KBi |
#14 |
Correcto
|
0.36 s | 17 KBi |
N = input() linea = input() C = input() consultas = [] for i in range(0,int(C)): con = input() consultas.append( [int(x) for x in con.split()]) arreglo= [int(x) for x in linea.split()] acomulado = [] valor = 0 for i in arreglo: valor = valor + i acomulado.append(valor) for i in consultas: p = i[0] q = i[1] suma = 0 suma = acomulado[q] if p-1>=0: suma = suma - acomulado[p-1] print(suma)