Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.027 s | 5 KBi |
#3 |
Correcto
|
0.024 s | 4 KBi |
#4 |
Correcto
|
0.023 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.024 s | 3 KBi |
#7 |
Correcto
|
0.031 s | 3 KBi |
#8 |
Correcto
|
0.054 s | 7 KBi |
#9 |
Correcto
|
0.058 s | 4 KBi |
#10 |
Correcto
|
0.061 s | 4 KBi |
#11 |
Correcto
|
0.057 s | 4 KBi |
#12 |
Correcto
|
0.059 s | 5 KBi |
#13 |
Correcto
|
0.061 s | 4 KBi |
#14 |
Correcto
|
0.056 s | 4 KBi |
N = int(input()) array = input() arr = [int(num) for num in array.split()] num_query = int(input()) accum_sum = [arr[0]] for i in range(1, N): accum_sum.append(accum_sum[i-1] + arr[i]) sum_subarr = [] for k in range(num_query): query = input() A = query.split() p, q = int(A[0]), int(A[1]) sum_subarr.append(accum_sum[q] - accum_sum[p] + arr[p]) print(*sum_subarr, sep="\n")