Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Correcto
|
0.021 s | 3 KBi |
#3 |
Correcto
|
0.026 s | 3 KBi |
#4 |
Correcto
|
0.021 s | 3 KBi |
#5 |
Correcto
|
0.03 s | 7 KBi |
#6 |
Correcto
|
0.023 s | 3 KBi |
#7 |
Correcto
|
0.024 s | 3 KBi |
#8 |
Correcto
|
0.118 s | 4 KBi |
#9 |
Correcto
|
0.499 s | 8 KBi |
#10 |
Correcto
|
0.532 s | 9 KBi |
#11 |
Correcto
|
0.49 s | 9 KBi |
#12 |
Correcto
|
0.506 s | 9 KBi |
#13 |
Correcto
|
0.498 s | 9 KBi |
#14 |
Correcto
|
0.532 s | 9 KBi |
def solve(sum, p, q): s = sum[q] if p - 1 >= 0: s -= sum[p-1] print(s) def main(): num_elements = int(input()) elements = list(map(int, input().split(" "))) sum = [elements[0]] for i in range(1, len(elements)): sum.append(sum[i-1] + elements[i]) num_queries = int(input()) for _ in range(0, num_queries): p, q = list(map(int,input().split())) solve(sum, p, q) if __name__ == "__main__": main()