Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 7 KBi |
#2 |
Correcto
|
0.004 s | 6 KBi |
#3 |
Correcto
|
0.005 s | 8 KBi |
#4 |
Correcto
|
0.005 s | 6 KBi |
#5 |
Correcto
|
0.004 s | 6 KBi |
#6 |
Correcto
|
0.004 s | 6 KBi |
#7 |
Correcto
|
0.004 s | 7 KBi |
#8 |
Correcto
|
0.004 s | 53 KBi |
#9 |
Correcto
|
0.004 s | 6 KBi |
#10 |
Correcto
|
0.005 s | 7 KBi |
#11 |
Incorrecto
|
0.004 s | 6 KBi |
#12 |
Incorrecto
|
0.005 s | 6 KBi |
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { reader := bufio.NewReader(os.Stdin) data, _ := reader.ReadString('\n') data = strings.ReplaceAll(data, "\n", "") data2, _ := reader.ReadString('\n') data2 = strings.ReplaceAll(data2, "\n", "") lenght, _ := strconv.ParseInt(data, 10, 0) number1 := 0 number2 := lenght - 1 numbers := strings.Split(data2, " ") for number1 <= int(number2) { numberFirst := numbers[number1] numberSecond := numbers[number1+1] if numberFirst > numberSecond { fmt.Println("Desordenado") return } numberLast := numbers[number2] numberLastSecond := numbers[number2-1] if numberLastSecond > numberLast { fmt.Println("Desordenado") return } number1++ number2-- } fmt.Println("Ordenado") }