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

Envío 1025

Problema 0x25 - Suma de un subarreglo grande

  • Autor: javierandresgp
  • Fecha: 2020-10-08 02:28:06 UTC (Hace alrededor de 4 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 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.021 s 3 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.025 s 3 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.02 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 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.022 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 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.022 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 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.02 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 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.02 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 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.052 s 5 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.19 s 12 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.188 s 12 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.183 s 12 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.183 s 12 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.217 s 14 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    sumElements(p, q)
NameError: name 'sumElements' is not defined
0.185 s 14 KBi
Puntos totales: 0 / 100

Código

nElements = int(input())
elements = list(map(int, input().rsplit(" ")))
nQueries = int(input())
queries = []
while (nQueries > 0):
    query = list(map(int, input().rsplit(" ")))
    queries.append(query)
    nQueries -= 1
for query in queries:
    p = query[0]
    q = query[1]
    q = q + 1
    sumElements(p, q)
def sumElements(p, q):
    add = 0
    for element in range(p, q):
        add += elements[element]
    print(add)