Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.027 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.021 s | 3 KBi |
#4 |
Correcto
|
0.03 s | 3 KBi |
#5 |
Correcto
|
0.021 s | 3 KBi |
#6 |
Incorrecto
|
0.022 s | 3 KBi |
#7 |
Incorrecto
|
0.026 s | 7 KBi |
#8 |
Incorrecto
|
0.152 s | 4 KBi |
#9 |
Incorrecto
|
0.706 s | 8 KBi |
#10 |
Incorrecto
|
1.178 s | 9 KBi |
#11 |
Incorrecto
|
0.839 s | 9 KBi |
#12 |
Incorrecto
|
0.817 s | 10 KBi |
#13 |
Correcto
|
0.858 s | 8 KBi |
#14 |
Tiempo límite excedido
|
1.56 s | 9 KBi |
a = [] N = 0 C = 0 pq = [] p = 0 q = 0 sum_sub_a = 0 sum_total = 0 N = int(input()) for num in input().split(' '): x = int(num) sum_total += x a.append(x) C = int(input()) for consult in range(C): pq =[] sum_sub_a = 0 p = 0 q = 0 for entry in input().split(' '): y = int(entry) pq.append(y) p = pq [0] q = pq [1] if p==0 and q==N: print(sum_total) elif q-p < N/2: sum_sub_a = sum(a[p:q+1]) print(sum_sub_a) else: sum_0p = sum(a[:p+1]) sum_qn = sum(a[q:N]) sum_sub_a = sum_total - sum_0p - sum_qn print(sum_sub_a)