█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 3383

Problema 0x25 - Suma de un subarreglo grande

  • Autor: juanan150
  • Fecha: 2021-03-12 17:33:40 UTC (Hace alrededor de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.026 s 3 KBi
#2
Correcto
0.027 s 3 KBi
#3
Correcto
0.027 s 3 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.033 s 3 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.021 s 3 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.024 s 3 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.023 s 3 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.058 s 4 KBi
#9
Esperando resultado...
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.051 s 9 KBi
#11
Esperando resultado...
#12
Esperando resultado...
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 14, in <module>
    val += list[j]
TypeError: 'type' object is not subscriptable
0.075 s 9 KBi
#14
Esperando resultado...
Puntos totales: 15 / 100

Código

N = int(input())
listn = [int(x) for x in input().split()]
cases = int(input())

for _ in range(cases):
    p,q=[int(x) for x in input().split()]
    if p== 0 and q == N:
        print(sum(listn))
    elif p == q:
        print(listn[p])
    else:
        val = listn[p]
        for j in range (p+1,q+1):
            val += list[j]
        print(val)