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

Envío 591

Problema 0xcf - Mirando al horizonte

  • Autor: yasuo
  • Fecha: 2020-09-08 19:33:39 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.204 s 18 KBi
#2
Correcto
0.242 s 15 KBi
#3
Correcto
0.235 s 17 KBi
#4
Correcto
0.242 s 15 KBi
#5
Correcto
0.244 s 16 KBi
#6
Tiempo límite excedido
1.022 s 57 KBi
#7
Tiempo límite excedido
0.703 s 59 KBi
#8
Tiempo límite excedido
1.048 s 62 KBi
#9
Tiempo límite excedido
0.794 s 59 KBi
#10
Tiempo límite excedido
1.055 s 85 KBi
Puntos totales: 50 / 100

Código

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int numberCase = scanner.nextInt();

        for(int n = 0; n < numberCase; n++){

            int building = scanner.nextInt();
            int[] arrTall = new int[building];
            String arrCovered = "";

            for(int i = 0; i < arrTall.length; i++){
                arrTall[i] = scanner.nextInt();
            }

            for (int i = 0; i < arrTall.length; i++) {
                boolean flag = false;
                for(int j = i+1; j < arrTall.length; j++){
                    if(arrTall[i] < arrTall[j]){
                        flag = true;
                        arrCovered = arrCovered + " " + arrTall[j];
                        break;
                    }
                }
                if(flag == false){
                    arrCovered = arrCovered + " " + -1;
                }
            }


            System.out.print("Case #"+(n+1)+":" + arrCovered);
            System.out.println();
        }
    }
}