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

Envío 727

Problema 0xcf - Mirando al horizonte

  • Autor: cposada8
  • Fecha: 2020-09-14 17:34:32 UTC (Hace más de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#2
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#3
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#4
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#5
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#6
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#7
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#8
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#9
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
#10
Error de compilación
                      main.c:1:1: error: unknown type name 'def'
def mirar_horizonte(alturas):
^
main.c:1:29: error: expected function body after function declarator
def mirar_horizonte(alturas):
                            ^
main.c:25:3: error: invalid preprocessing directive
# mirando al horizonte
  ^
main.c:26:4: error: GNU line marker directive requires a simple digit sequence
# 0xcf - Mirando al horizonte
   ^
4 errors generated.

                    
Puntos totales: 0 / 100

Código

def mirar_horizonte(alturas):
    max_alt = 0
    salidas = [None]*len(alturas)
    
    for i in reversed(range(len(alturas))):
        altura_act = alturas[i]
        
        if altura_act>max_alt:
            max_alt = altura_act
            
        if alturas[i] == max_alt:
            salidas[i] = -1
        else:
            salidas[i] = max_alt
    return salidas


def print_case(case_index, answer):
    print(f"Case #{case_index+1}:", end="")
    for x in answer:
        print(f" x", end="")
    print()


# mirando al horizonte
# 0xcf - Mirando al horizonte
C = int(input())
for case in range(C):
    N = int(input())
    alturas = [int(x) for x in input().split()]
    print_case(case, mirar_horizonte(alturas))