Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.029 s | 3 KBi |
#2 |
Correcto
|
0.019 s | 3 KBi |
#3 |
Correcto
|
0.025 s | 3 KBi |
#4 |
Correcto
|
0.037 s | 3 KBi |
#5 |
Correcto
|
0.025 s | 3 KBi |
#6 |
Correcto
|
0.038 s | 5 KBi |
#7 |
Correcto
|
0.026 s | 3 KBi |
#8 |
Correcto
|
0.096 s | 5 KBi |
#9 |
Correcto
|
0.234 s | 14 KBi |
#10 |
Esperando resultado...
|
||
#11 |
Correcto
|
0.55 s | 14 KBi |
#12 |
Esperando resultado...
|
||
#13 |
Correcto
|
0.378 s | 15 KBi |
#14 |
Correcto
|
0.388 s | 15 KBi |
n = input() size = int(n) array = size *[0] total_a = size *[0] adition_a = 0 number = input() args = number.split() c = input() query_number = int(c) p = query_number *[0] q = query_number *[0] for i in range (0,size): array[i] = int(args[i]) for i in range(0,query_number): query_pq= input() token = query_pq.split() p[i]=int(token[0]) q[i]=int(token[1]) adition = 0 for i in range(0,size): adition = adition + array[i] total_a[i] = adition i =0 for i in range(0,query_number): adition_a = 0 if int(p[i])== 0: adition_a = total_a[q[i]] if int(p[i]) == q[i]: adition_a = array[q[i]] if int(q[i]) > int(p[i]) and int(p[i])!= 0: adition_a = total_a[q[i]] - total_a[p[i]-1] print(adition_a)