Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.042 s | 7 KBi |
#2 |
Correcto
|
0.032 s | 3 KBi |
#3 |
Correcto
|
0.033 s | 3 KBi |
#4 |
Correcto
|
0.031 s | 3 KBi |
#5 |
Correcto
|
0.036 s | 3 KBi |
#6 |
Correcto
|
0.043 s | 7 KBi |
#7 |
Correcto
|
0.036 s | 3 KBi |
#8 |
Correcto
|
0.144 s | 4 KBi |
#9 |
Correcto
|
0.52 s | 9 KBi |
#10 |
Correcto
|
0.538 s | 9 KBi |
#11 |
Correcto
|
0.536 s | 9 KBi |
#12 |
Correcto
|
0.496 s | 9 KBi |
#13 |
Correcto
|
0.599 s | 9 KBi |
#14 |
Correcto
|
0.587 s | 9 KBi |
import itertools as it n_arr = int(input()) arr = [int(i) for i in input().split(' ')] n_q = int(input()) qs = (list(map(int, input().split(' '))) for _ in range(n_q)) psums = list(it.accumulate(arr)) for p, q in qs: psum, qsum = psums[p-1] * (p > 0), psums[q] print(qsum-psum)