Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 3 KBi |
#2 |
Correcto
|
0.023 s | 3 KBi |
#3 |
Correcto
|
0.023 s | 3 KBi |
#4 |
Correcto
|
0.021 s | 3 KBi |
#5 |
Correcto
|
0.021 s | 3 KBi |
#6 |
Correcto
|
0.025 s | 3 KBi |
#7 |
Correcto
|
0.024 s | 3 KBi |
#8 |
Correcto
|
0.067 s | 5 KBi |
#9 |
Correcto
|
0.293 s | 15 KBi |
#10 |
Correcto
|
0.272 s | 15 KBi |
#11 |
Correcto
|
0.291 s | 15 KBi |
#12 |
Correcto
|
0.271 s | 15 KBi |
#13 |
Correcto
|
0.327 s | 16 KBi |
#14 |
Correcto
|
0.299 s | 16 KBi |
def printSum(p, q): if (p == 0): print(allSums[q]) else: print(allSums[q] - allSums[p - 1]) nElements = int(input()) elements = list(map(int, input().rsplit(" "))) allSums = [] aSum = 0 for element in elements: aSum += element allSums.append(aSum) nQueries = int(input()) queries = [] while (nQueries > 0): query = list(map(int, input().rsplit(" "))) queries.append(query) nQueries -= 1 for query in queries: p = query[0] q = query[1] printSum(p, q)