Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.022 s | 3 KBi |
#2 |
Correcto
|
0.02 s | 3 KBi |
#3 |
Correcto
|
0.022 s | 3 KBi |
#4 |
Correcto
|
0.024 s | 3 KBi |
#5 |
Correcto
|
0.022 s | 3 KBi |
#6 |
Correcto
|
0.514 s | 48 KBi |
#7 |
Correcto
|
0.395 s | 46 KBi |
#8 |
Correcto
|
0.444 s | 60 KBi |
#9 |
Correcto
|
0.448 s | 49 KBi |
#10 |
Correcto
|
0.472 s | 64 KBi |
def get_blocking_buildings(building_sizes): output = [] blocking_buildings = [] for building in building_sizes[::-1]: while blocking_buildings and building >= blocking_buildings[-1]: blocking_buildings.pop() output.append(-1 if not blocking_buildings else blocking_buildings[-1]) blocking_buildings.append(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()