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

Envío 4405

Problema 0xcf - Mirando al horizonte

  • Autor: 8cypherp
  • Fecha: 2021-06-16 21:31:18 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.003 s 13 KBi
#2
Error interno
No such file or directory @ rb_sysopen - /box/main.c
#3
Incorrecto
0.006 s 11 KBi
#4
Incorrecto
0.004 s 1 KBi
#5
Incorrecto
0.003 s 1 KBi
#6
Tiempo límite excedido
1.048 s 3 KBi
#7
Tiempo límite excedido
1.049 s 42 KBi
#8
Tiempo límite excedido
1.053 s 3 KBi
#9
Tiempo límite excedido
1.048 s 3 KBi
#10
Error interno
No such file or directory @ rb_sysopen - /box/main.c
Puntos totales: 0 / 100

Código

#include <stdio.h>

void solveCase()
{
    int N;
    scanf("%d",&N);
    int a[N];
    for (int j =0; j < N; ++j)
    {
        scanf("%d",&a[j]);
    }
    
    for (int i = 0; i < N; ++i)
    {
        int answer=-1;
        for (int j = i+1; j < N; ++j)
        {
            if (a[j] > a[i])
            {
                answer=a[j];
                break;
            } 
        }
        printf(" %d",answer);
    }
    printf("\n");
}

int main(void)
{   
    int c;
    scanf("%d",&c);
    for ( int i = 1; i <= c; ++i)
    {
        printf("CASE #%d:",i);
        solveCase();
    }
    return 0;

}