Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.024 s | 3 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Correcto
|
0.022 s | 3 KBi |
#5 |
Correcto
|
0.024 s | 3 KBi |
#6 |
Correcto
|
0.021 s | 3 KBi |
#7 |
Correcto
|
0.023 s | 3 KBi |
#8 |
Correcto
|
0.099 s | 4 KBi |
#9 |
Correcto
|
0.39 s | 8 KBi |
#10 |
Correcto
|
0.364 s | 9 KBi |
#11 |
Correcto
|
0.404 s | 9 KBi |
#12 |
Correcto
|
0.382 s | 9 KBi |
#13 |
Correcto
|
0.414 s | 9 KBi |
#14 |
Correcto
|
0.405 s | 9 KBi |
_ = input() array = [int(x) for x in input().split()] N_subs = int(input()) def cum_sum(array): result = [0] for num in array: result.append(result[-1] + num) return result[1:] sum_array = cum_sum(array) for i in range(N_subs): p , q = [int(x) for x in input().split()] if p == 0: print(sum_array[q]) else: print(sum_array[q] - sum_array[p-1])