Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.023 s | 3 KBi |
#2 |
Incorrecto
|
0.033 s | 7 KBi |
#3 |
Incorrecto
|
0.026 s | 7 KBi |
#4 |
Incorrecto
|
0.026 s | 3 KBi |
#5 |
Incorrecto
|
0.027 s | 3 KBi |
#6 |
Incorrecto
|
0.039 s | 3 KBi |
#7 |
Incorrecto
|
0.025 s | 3 KBi |
#8 |
Incorrecto
|
0.085 s | 5 KBi |
#9 |
Incorrecto
|
0.331 s | 13 KBi |
#10 |
Incorrecto
|
0.3 s | 13 KBi |
#11 |
Incorrecto
|
0.311 s | 13 KBi |
#12 |
Incorrecto
|
0.271 s | 13 KBi |
#13 |
Tiempo límite excedido
|
0.124 s | 11 KBi |
#14 |
Incorrecto
|
0.341 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(1,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)