Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.021 s | 3 KBi |
#2 |
Correcto
|
0.021 s | 3 KBi |
#3 |
Correcto
|
0.021 s | 3 KBi |
#4 |
Correcto
|
0.021 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.021 s | 3 KBi |
#7 |
Correcto
|
0.021 s | 3 KBi |
#8 |
Correcto
|
0.101 s | 7 KBi |
#9 |
Correcto
|
0.377 s | 8 KBi |
#10 |
Correcto
|
0.394 s | 9 KBi |
#11 |
Correcto
|
0.381 s | 9 KBi |
#12 |
Correcto
|
0.376 s | 9 KBi |
#13 |
Correcto
|
0.406 s | 9 KBi |
#14 |
Correcto
|
0.409 s | 11 KBi |
n = int(input()) a = [int(x) for x in input().split()] prefix_sum = [] _sum = 0 for x in a: _sum += x prefix_sum.append(_sum) c = int(input()) for _ in range(c): p, q = [int(x) for x in input().split()] answer = prefix_sum[q] if p - 1 >= 0: answer -= prefix_sum[p - 1] print(answer)