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

Envío 4819

Problema 0x25 - Suma de un subarreglo grande

  • Autor: josuedzp
  • Fecha: 2021-08-24 07:13:55 UTC (Hace más de 2 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.022 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.024 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.021 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.019 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.023 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.021 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 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.027 s 4 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.045 s 8 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.041 s 9 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.058 s 9 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.055 s 9 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.052 s 9 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 23, in <module>
    main()
  File "script.py", line 8, in main
    for i in range(0, num_queries):
TypeError: 'list' object cannot be interpreted as an integer
0.041 s 9 KBi
Puntos totales: 0 / 100

Código

def main():
  num_elements = int(input())
  elements = [int(x) for x in input().split(" ")]
  parsed_elements = elements[0:num_elements]
  num_queries = [int(x) for x in input().split(" ")]
  queries = []
  for i in range(0, num_queries):
    query = input().split(" ")
    queries.append(query)


  for i in range(0, num_queries):
    first_index = queries[i][0]
    last_index = queries[i][-1] + 1
    array = parsed_elements[first_index:last_index]
    result = sum(array)
    print(result)



if __name__ == "__main__":
  main()