Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 53 KBi |
#2 |
Correcto
|
0.005 s | 27 KBi |
#3 |
Correcto
|
0.031 s | 18 KBi |
#4 |
Tiempo límite excedido
|
1.006 s | 7 KBi |
#5 |
Tiempo límite excedido
|
1.029 s | 6 KBi |
#6 |
Tiempo límite excedido
|
1.058 s | 48 KBi |
#7 |
Tiempo límite excedido
|
1.05 s | 9 KBi |
#8 |
Tiempo límite excedido
|
1.086 s | 16 KBi |
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) 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] sliceNumber := numbers[numberOne : numberTwo+1] result := 0 for i := 0; i < len(sliceNumber); i++ { if sliceNumber[i] == numberSearch { result++ } } fmt.Println(result) } }