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

Envío 5781

Problema 0x9d - ¿Está ordenado?

  • Autor: Sugaaron
  • Fecha: 2022-02-28 03:01:55 UTC (Hace alrededor de 2 años)
Caso # Resultado Tiempo Memoria
#1
Incorrecto
0.04 s 14 KBi
#2
Correcto
0.042 s 13 KBi
#3
Correcto
0.04 s 14 KBi
#4
Correcto
0.072 s 16 KBi
#5
Correcto
0.039 s 14 KBi
#6
Incorrecto
0.039 s 14 KBi
#7
Incorrecto
0.078 s 12 KBi
#8
Incorrecto
0.078 s 10 KBi
#9
Correcto
0.078 s 38 KBi
#10
Correcto
0.083 s 17 KBi
#11
Incorrecto
0.067 s 15 KBi
#12
Incorrecto
0.065 s 18 KBi
Puntos totales: 50 / 100

Código

import java.io.*;
import java.util.StringTokenizer;

class Main
{
    public static void main(String[] args) throws IOException{
        
        int mayor = Integer.MIN_VALUE;
        int contador = 0;
        
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(bf.readLine());
        int cantidad = Integer.parseInt(st.nextToken());

        while(st.hasMoreTokens()){
            int valor = Integer.parseInt(st.nextToken());
            if(valor>mayor){
                mayor=valor;
                contador++;
            }
        }
        if(contador==cantidad){
            System.out.println("Ordenado");
        }else{
            System.out.println("Desordenado");
        }
    }
}