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

Envío 4826

Problema 0x25 - Suma de un subarreglo grande

  • Autor: josuedzp
  • Fecha: 2021-08-26 10:39:53 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.023 s 3 KBi
#2
Incorrecto
0.027 s 3 KBi
#3
Incorrecto
0.021 s 3 KBi
#4
Incorrecto
0.02 s 3 KBi
#5
Incorrecto
0.02 s 3 KBi
#6
Incorrecto
0.027 s 3 KBi
#7
Incorrecto
0.024 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 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.096 s 8 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.108 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 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.125 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 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.122 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 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.118 s 13 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.124 s 12 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Traceback (most recent call last):
  File "script.py", line 22, in <module>
    main()
  File "script.py", line 19, in main
    solve(sum, p, q)
  File "script.py", line 2, in solve
    print(sum, p, q)
OSError: [Errno 27] File too large
0.115 s 12 KBi
Puntos totales: 0 / 100

Código

def solve(sum, p, q):
  print(sum, p, q)
  s = sum[q]
  if p - 1 >= 0:
    s -= sum[p-1]
  print(s)

def main():
  num_elements = int(input())
  elements = list(map(int, input().split(" ")))

  sum = [elements[0]]
  for i in range(1, len(elements)):
    sum.append(sum[i-1] + elements[i])

  num_queries = int(input())
  for _ in range(0, num_queries):
    p, q = list(map(int,input().split()))
    solve(sum, p, q)

if __name__ == "__main__":
  main()