Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.042 s | 4 KBi |
#2 |
Correcto
|
0.025 s | 3 KBi |
#3 |
Correcto
|
0.031 s | 3 KBi |
#4 |
Correcto
|
0.027 s | 3 KBi |
#5 |
Correcto
|
0.03 s | 3 KBi |
#6 |
Correcto
|
0.03 s | 3 KBi |
#7 |
Correcto
|
0.026 s | 3 KBi |
#8 |
Correcto
|
0.515 s | 5 KBi |
#9 |
Tiempo límite excedido
|
1.045 s | 8 KBi |
#10 |
Esperando resultado...
|
||
#11 |
Esperando resultado...
|
||
#12 |
Tiempo límite excedido
|
1.063 s | 9 KBi |
#13 |
Correcto
|
0.706 s | 9 KBi |
#14 |
Esperando resultado...
|
N = int(input()) listn = [int(x) for x in input().split()] cases = int(input()) total = sum(listn) for _ in range(cases): p,q=[int(x) for x in input().split()] if q - p >= N/2: val1 = 0 val2 = 0 for l in range(p): val1 += listn[l] for m in range(q+1,N): val2 += listn[m] print(total - val1 - val2) else: val = listn[p] for j in range(p+1,q+1): val += listn[j] print(val)