Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.019 s | 3 KBi |
#2 |
Correcto
|
0.016 s | 3 KBi |
#3 |
Correcto
|
0.015 s | 3 KBi |
#4 |
Correcto
|
0.015 s | 3 KBi |
#5 |
Correcto
|
0.016 s | 3 KBi |
#6 |
Correcto
|
0.018 s | 3 KBi |
#7 |
Correcto
|
0.019 s | 3 KBi |
#8 |
Correcto
|
0.057 s | 5 KBi |
#9 |
Correcto
|
0.179 s | 16 KBi |
#10 |
Correcto
|
0.186 s | 16 KBi |
#11 |
Correcto
|
0.177 s | 16 KBi |
#12 |
Correcto
|
0.208 s | 16 KBi |
#13 |
Correcto
|
0.199 s | 17 KBi |
#14 |
Correcto
|
0.197 s | 17 KBi |
n = int(input()) elementsArray = [int(item) for item in input().split()] c = int(input()) querysArray = [] for i in range(0, c): querysArray.append([int(item) for item in input().split()]) sumArray = [0] * (n + 1) for i in range(1, n + 1): sumArray[i] = sumArray[i - 1] + elementsArray[i - 1] resultArray = [0] * c for i in range(0, c): p = querysArray[i][0] q = querysArray[i][1] resultArray[i] = sumArray[q + 1] - sumArray[p] for i in resultArray: print(i)