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

Envío 1383

Problema 0xcf - Mirando al horizonte

  • Autor: judavid.arias
  • Fecha: 2020-10-24 20:34:32 UTC (Hace alrededor de 2 años)
Caso # Resultado Tiempo Memoria
#1
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.115 s 12 KBi
#2
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.093 s 17 KBi
#3
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.111 s 12 KBi
#4
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.113 s 12 KBi
#5
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.111 s 12 KBi
#6
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.085 s 11 KBi
#7
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.089 s 18 KBi
#8
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.085 s 12 KBi
#9
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.086 s 12 KBi
#10
Error en tiempo de ejecución (NZEC)
Exited with error status 1
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: com/company/Main (wrong name: Main)
0.086 s 11 KBi
Puntos totales: 0 / 100

Código

package com.company;

import java.util.LinkedList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c = sc.nextInt();

        for(int j = 0;j<c;j++){
            int N = sc.nextInt();
            int []array = new int[N];
            int []solve= new int[N];
            for(int i = 0;i<N;i++)
            {
                array[i] = sc.nextInt();
            }

            LinkedList<Integer> l = new LinkedList<>();
            for(int i = N-1;i>=0;i--){
                if(l.size() > 0 ){
                    while(!l.isEmpty() && array[i]>=l.peekFirst()){
                        l.pollFirst();
                    }

                    if(l.size() == 0){
                        solve[i] = -1;
                        l.push(array[i]);
                    }else{
                        solve[i] = l.peekFirst();
                        l.push(array[i]);
                    }

                }else{
                    solve[i] = -1;
                    l.push(array[i]);
                }

            }

            System.out.print("Case #" + (j+1) + ":");
            for(int i = 0;i<N;i++)
                System.out.print(" " + solve[i]);

            System.out.println();

        }
    }
}