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

Envío 635

Problema 0xf2 - Partir un arreglo grande en 2

  • Autor: Mejibyte
  • Fecha: 2020-09-12 23:37:23 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
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.085 s 9 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.096 s 9 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.091 s 9 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.095 s 9 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.082 s 9 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.081 s 9 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.091 s 9 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.094 s 9 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.108 s 10 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.089 s 10 KBi
#11
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.086 s 9 KBi
#12
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.092 s 9 KBi
#13
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.101 s 10 KBi
#14
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.076 s 9 KBi
#15
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.071 s 9 KBi
#16
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.085 s 9 KBi
#17
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.07 s 9 KBi
#18
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.092 s 9 KBi
#19
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.087 s 9 KBi
#20
Error en tiempo de ejecución (NZEC)
Exited with error status 1
script.rb:1: syntax error, unexpected ':'
def solve(a, n):
               ^
script.rb:2: syntax error, unexpected ':', expecting `do' for condition or ';' or '\n'
  for i in range(n):
                   ^
script.rb:3: syntax error, unexpected ':', expecting ']'
    left = sum(a[0:i])
                  ^
script.rb:5: syntax error, unexpected ':', expecting `then' or ';' or '\n'
    if left > 0 and right < 0:
                             ^
script.rb:10: syntax error, unexpected ':', expecting `then' or ';' or '\n'
if __name__ == "__main__":
                         ^
script.rb:12: syntax error, unexpected `for', expecting ']'
  a = [int(x) for x in input().split()]
              ^~~
script.rb:12: syntax error, unexpected ']', expecting `do' for condition or ';' or '\n'
...nt(x) for x in input().split()]
...                              ^
script.rb:13: syntax error, unexpected end-of-input, expecting `end'
0.083 s 9 KBi
Puntos totales: 0 / 100

Código

def solve(a, n):
  for i in range(n):
    left = sum(a[0:i])
    right = sum(a[i:n])
    if left > 0 and right < 0:
      print(i)
      return
  print("Impossible")

if __name__ == "__main__":
  n = int(input())
  a = [int(x) for x in input().split()]
  solve(a, n)