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

Envío 662

Problema 0xf2 - Partir un arreglo grande en 2

  • Autor: Rafael
  • Fecha: 2020-09-13 22:03:26 UTC (Hace más de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#2
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#3
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#4
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#5
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#6
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#7
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#8
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#9
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#10
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#11
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#12
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#13
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#14
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#15
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#16
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#17
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#18
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#19
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
#20
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:18:24: error: expected ';' after top level declarator
    print("Impossible")
                       ^
                       ;
1 warning and 2 errors generated.

                    
Puntos totales: 0 / 100

Código

n = int(input())
nums = list(map(int, input().split()))
left = [0 for x in range(n)]
right = [0 for x in range(n)]
left[0] = nums[0]
right[0] = nums[n - 1]
for i in range(1, n):
    left[i] = left[i - 1] + nums[i]
for i in reversed(range(n - 2)):
   right[i] = right[i + 1] + nums[i]
flag = True
for i in range(n - 1):
    if left[i] > 0 and right[i + 1] < 0:
        print(i + 1)
        flag = False
        break
if flag:
    print("Impossible")