Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.026 s | 3 KBi |
#2 |
Correcto
|
0.021 s | 3 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Correcto
|
0.021 s | 3 KBi |
#5 |
Correcto
|
0.02 s | 3 KBi |
#6 |
Correcto
|
0.021 s | 3 KBi |
#7 |
Correcto
|
0.026 s | 3 KBi |
#8 |
Tiempo límite excedido
|
1.521 s | 5 KBi |
#9 |
Tiempo límite excedido
|
1.585 s | 13 KBi |
#10 |
Tiempo límite excedido
|
1.555 s | 13 KBi |
#11 |
Tiempo límite excedido
|
1.568 s | 13 KBi |
#12 |
Tiempo límite excedido
|
1.506 s | 13 KBi |
#13 |
Correcto
|
0.253 s | 14 KBi |
#14 |
Tiempo límite excedido
|
1.51 s | 14 KBi |
def main(): num_elements = int(input()) elements = [int(x) for x in input().split(" ")] parsed_elements = elements[0:num_elements] num_queries = int(input()) queries = [] for i in range(0, num_queries): query = [int(x) for x in input().split(" ")] queries.append(query) for i in range(0, num_queries): first_index = queries[i][0] last_index = queries[i][-1] + 1 array = parsed_elements[first_index:last_index] result = sum(array) print(result) if __name__ == "__main__": main()