Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 5 KBi |
#2 |
Correcto
|
0.004 s | 6 KBi |
#3 |
Correcto
|
0.004 s | 6 KBi |
#4 |
Correcto
|
0.004 s | 5 KBi |
#5 |
Correcto
|
0.004 s | 4 KBi |
#6 |
Correcto
|
0.006 s | 5 KBi |
#7 |
Correcto
|
0.006 s | 5 KBi |
#8 |
Correcto
|
0.004 s | 6 KBi |
#9 |
Correcto
|
0.005 s | 6 KBi |
#10 |
Correcto
|
0.006 s | 6 KBi |
#11 |
Correcto
|
0.004 s | 6 KBi |
#12 |
Correcto
|
0.003 s | 4 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, _ := strconv.ParseInt(numbers[number1], 10, 64) numberSecond, _ := strconv.ParseInt(numbers[number1+1], 10, 64) if numberFirst > numberSecond { fmt.Println("Desordenado") return } numberLast, _ := strconv.ParseInt(numbers[number2], 10, 64) numberLastSecond, _ := strconv.ParseInt(numbers[number2-1], 10, 64) if numberLastSecond > numberLast { fmt.Println("Desordenado") return } number1++ number2-- } fmt.Println("Ordenado") }