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

Envío 1080

Problema 0x9d - ¿Está ordenado?

  • Autor: datruq
  • Fecha: 2020-10-09 19:40:52 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#2
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#3
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#4
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#5
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#6
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#7
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#8
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#9
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#10
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#11
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
#12
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void Main(String[] args) {
              ^
Main.java:4: error: class, interface, or enum expected
        int size = Integer.parseInt(sn.nextLine());
        ^
Main.java:5: error: class, interface, or enum expected
        String[] arItems = sn.nextLine().split(" ");
        ^
Main.java:6: error: class, interface, or enum expected
        List<Integer> entries = new ArrayList<>();
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                        ^
Main.java:7: error: class, interface, or enum expected
        for (int i = 0; i < size; i++) {
                                  ^
Main.java:9: error: class, interface, or enum expected
            entries.add(arItem);
            ^
Main.java:10: error: class, interface, or enum expected
        }
        ^
Main.java:12: error: class, interface, or enum expected
        System.out.println(respuesta);
        ^
Main.java:13: error: class, interface, or enum expected
    }
    ^
Main.java:17: error: class, interface, or enum expected
        boolean isOrdered = false;
        ^
Main.java:18: error: class, interface, or enum expected
        for(int i : list) {
        ^
Main.java:20: error: class, interface, or enum expected
            min = i;
            ^
Main.java:21: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
    }
    ^
16 errors

                    
Puntos totales: 0 / 100

Código

public static void Main(String[] args) {

        Scanner sn = new Scanner(System.in);
        int size = Integer.parseInt(sn.nextLine());
        String[] arItems = sn.nextLine().split(" ");
        List<Integer> entries = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            int arItem = Integer.parseInt(arItems[i]);
            entries.add(arItem);
        }
        String respuesta = ordernar(size, entries) ? "Ordenado" : "Desordenado";
        System.out.println(respuesta);
    }

    private static boolean ordernar(int size, List<Integer> list) {
        int min = 0;
        boolean isOrdered = false;
        for(int i : list) {
            if(i<min) return false;
            min = i;
        }
        return true;
    }