Envío 716
- Autor: abatesins
- Fecha: 2020-09-14 14:48:08 UTC (Hace más de 4 años)
Caso # |
Resultado |
Tiempo |
Memoria |
#1 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.028 s
|
5 KBi |
#2 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.028 s
|
3 KBi |
#3 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.029 s
|
3 KBi |
#4 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.034 s
|
5 KBi |
#5 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.034 s
|
3 KBi |
#6 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.032 s
|
3 KBi |
#7 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.032 s
|
5 KBi |
#8 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.08 s
|
6 KBi |
#9 |
![](/assets/icons/clock-6608980c29fd2ccb1b383388151508fb475f4e9e867e5b65e68e5f3a744b0978.png)
Tiempo límite excedido
|
0.144 s
|
10 KBi |
#10 |
![](/assets/icons/clock-6608980c29fd2ccb1b383388151508fb475f4e9e867e5b65e68e5f3a744b0978.png)
Tiempo límite excedido
|
0.223 s
|
12 KBi |
#11 |
![](/assets/icons/tick-4eb7fe30dfcb3725c2160e595c283edefe3c05d3eca657720734a72e63b169db.png)
Correcto
|
0.322 s
|
17 KBi |
#12 |
![](/assets/icons/clock-6608980c29fd2ccb1b383388151508fb475f4e9e867e5b65e68e5f3a744b0978.png)
Tiempo límite excedido
|
0.159 s
|
11 KBi |
#13 |
![](/assets/icons/clock-6608980c29fd2ccb1b383388151508fb475f4e9e867e5b65e68e5f3a744b0978.png)
Tiempo límite excedido
|
0.23 s
|
13 KBi |
#14 |
![](/assets/icons/clock-6608980c29fd2ccb1b383388151508fb475f4e9e867e5b65e68e5f3a744b0978.png)
Tiempo límite excedido
|
0.209 s
|
16 KBi |
Puntos totales: 65 / 100
Código
n_arr = int(input())
raw_arr = input().split(' ')
n_q = int(input())
# Continue loading/parsing just within the range of queries
qs = [[0, 0]]*n_q
max_idx = 0
for rng in range(n_q):
p, q = input().split(' ')
p, q = int(p), int(q)
qs[rng] = [p, q]
max_idx = max(q, max_idx)
arr = list(map(int, raw_arr[:max_idx+1]))
# Integral array to yield sums in linear time
partial = [0]*(max_idx+2)
for n, p in enumerate(arr):
partial[n+1] = partial[n] + p
for q0, q1 in qs:
print(partial[q1+1]-partial[q0])