Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.026 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.026 s | 3 KBi |
#5 |
Correcto
|
0.028 s | 3 KBi |
#6 |
Correcto
|
0.023 s | 3 KBi |
#7 |
Correcto
|
0.021 s | 3 KBi |
#8 |
Tiempo límite excedido
|
1.568 s | 5 KBi |
#9 |
Tiempo límite excedido
|
1.564 s | 13 KBi |
#10 |
Tiempo límite excedido
|
1.577 s | 13 KBi |
#11 |
Tiempo límite excedido
|
1.549 s | 13 KBi |
#12 |
Tiempo límite excedido
|
1.566 s | 13 KBi |
#13 |
Correcto
|
0.268 s | 14 KBi |
#14 |
Tiempo límite excedido
|
1.56 s | 14 KBi |
def getInputs(): 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) return num_elements, parsed_elements, num_queries, queries def main(): num_elements, parsed_elements, num_queries, queries = getInputs() 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()