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

Envío 4820

Problema 0x25 - Suma de un subarreglo grande

  • Autor: josuedzp
  • Fecha: 2021-08-24 07:14:45 UTC (Hace más 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 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.03 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.019 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.03 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.025 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.021 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.019 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.047 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.04 s 9 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.044 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.053 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.04 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.047 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 = [int(x) for x in 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()