Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.023 s | 3 KBi |
#3 |
Correcto
|
0.02 s | 3 KBi |
#4 |
Correcto
|
0.022 s | 3 KBi |
#5 |
Incorrecto
|
0.023 s | 3 KBi |
#6 |
Incorrecto
|
0.024 s | 3 KBi |
#7 |
Incorrecto
|
0.024 s | 5 KBi |
#8 |
Incorrecto
|
0.05 s | 4 KBi |
#9 |
Incorrecto
|
0.069 s | 5 KBi |
#10 |
Incorrecto
|
0.1 s | 5 KBi |
#11 |
Incorrecto
|
0.073 s | 5 KBi |
#12 |
Incorrecto
|
0.07 s | 5 KBi |
#13 |
Incorrecto
|
0.072 s | 5 KBi |
#14 |
Incorrecto
|
0.071 s | 5 KBi |
n = int(input()) numbers = list(map(int, input().split())) c = int(input()) queries = [] for _ in range(c): query = list(map(int, input().split())) assert(0 <= query[0] <= n - 1) assert(0 <= query[1] <= n - 1) assert(query[0] <= query[1]) queries.append(query) current_sum = 0 sum_numbers = [] for number in numbers: current_sum = current_sum + number sum_numbers.append(current_sum) for query in queries: p, q = query if p == 0: print(sum_numbers[q]) else: print(sum_numbers[q] - sum_numbers[p])