Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.003 s | 30 KBi |
#2 |
Incorrecto
|
0.02 s | 4 KBi |
#3 |
Incorrecto
|
0.125 s | 18 KBi |
#4 |
Tiempo límite excedido
|
1.175 s | 11 KBi |
#5 |
Tiempo límite excedido
|
1.337 s | 10 KBi |
#6 |
Tiempo límite excedido
|
1.126 s | 11 KBi |
#7 |
Tiempo límite excedido
|
1.597 s | 9 KBi |
#8 |
Tiempo límite excedido
|
1.106 s | 9 KBi |
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) var numberPrinted int = 0 func main() { reader := bufio.NewReader(os.Stdin) n, _ := reader.ReadString('\n') n = strings.ReplaceAll(n, "\n", "") nArray, _ := reader.ReadString('\n') nArray = strings.ReplaceAll(nArray, "\n", "") numbers := strings.Split(nArray, " ") c, _ := reader.ReadString('\n') c = strings.ReplaceAll(c, "\n", "") cNumber, _ := strconv.ParseInt(c, 10, 64) for i := 0; i < int(cNumber); i++ { caseLine, _ := reader.ReadString('\n') caseLine = strings.ReplaceAll(caseLine, "\n", "") numbersCase := strings.Split(caseLine, " ") numberOne, _ := strconv.ParseInt(numbersCase[0], 10, 64) numberTwo, _ := strconv.ParseInt(numbersCase[1], 10, 64) numberSearch := numbersCase[2] sliceSearch := numbers[numberOne : numberTwo+1] go printData(sliceSearch, numberSearch, i) } } func printData(sliceSearch []string, number string, index int) { result := 0 for i := 0; i < len(sliceSearch); i++ { if sliceSearch[i] == number { result++ } } for index < numberPrinted { } numberPrinted++ fmt.Println(result) }