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

Envío 534

Problema 0xcf - Mirando al horizonte

  • Autor: d4vsanchez
  • Fecha: 2020-09-07 01:51:59 UTC (Hace más de 4 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.022 s 3 KBi
#2
Incorrecto
0.025 s 3 KBi
#3
Correcto
0.025 s 3 KBi
#4
Correcto
0.032 s 4 KBi
#5
Incorrecto
0.025 s 4 KBi
#6
Incorrecto
0.359 s 48 KBi
#7
Correcto
0.299 s 46 KBi
#8
Correcto
0.358 s 60 KBi
#9
Incorrecto
0.353 s 49 KBi
#10
Incorrecto
0.388 s 65 KBi
Puntos totales: 50 / 100

Código

def get_blocking_buildings(building_sizes):
    output = []
    highest_building = building_sizes[-1]
    for building in building_sizes[::-1]:
        if building >= highest_building:
            highest_building = building
        output.append(-1 if highest_building == building else highest_building)

    return reversed(output)

def main():
    building_sizes_cases = []
    cases = int(input())

    for case in range(cases):
        buildings = int(input())
        building_sizes = list(map(int, input().split()))
        assert len(building_sizes) == buildings
        building_sizes_cases.append(building_sizes)

    for index, building_sizes_case in enumerate(building_sizes_cases):
        output = [str(i) for i in get_blocking_buildings(building_sizes_case)]
        print("Case #{}: {}".format(index + 1, " ".join(output)))

if __name__ == "__main__":
    main()