Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Incorrecto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.003 s | 1 KBi |
#4 |
Correcto
|
0.004 s | 1 KBi |
#5 |
Incorrecto
|
0.004 s | 1 KBi |
#6 |
Incorrecto
|
0.117 s | 6 KBi |
#7 |
Correcto
|
0.076 s | 14 KBi |
#8 |
Correcto
|
0.097 s | 6 KBi |
#9 |
Incorrecto
|
0.083 s | 6 KBi |
#10 |
Incorrecto
|
0.151 s | 7 KBi |
#include <stdlib.h> #include <stdio.h> /** * print_hor - prints the output passed by find_hor function * @cant: the number of builtdings * @out: the array with the output to print * * Return: na */ void print_hor(int cant, int out[]) { while (cant > 0) { cant--; printf("%d", out[cant]); if (cant != 0) { putchar(' '); } } putchar(10); } /** * find_hor - sets an array with the case of output and * call to print_hor function * * Return: na */ void find_hor(void) { int i, j, cant = 0, edif[500000], horiz_edif = 0, out[500000]; scanf("%d", &cant); for (i = cant - 1, j = 0; i >= 0; i--, j++) { scanf("%d", &edif[j]); } horiz_edif = edif[cant - 1]; for (i = cant - 1, j = 0; i >= 0; i--, j++) { if (edif[i] < horiz_edif) { out[j] = horiz_edif; } else { horiz_edif = edif[i]; out[j] = -1; } } print_hor(cant, out); } /** * main - gets the number of cases and call to find_hor function * * Return: 0 */ int main(void) { int i, cases = 0; scanf("%d", &cases); for (i = 0; i < cases; i++) { printf("Case #%d: ", i + 1); find_hor(); } return (0); }