Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.007 s | 18 KBi |
#2 |
Correcto
|
0.006 s | 12 KBi |
#3 |
Correcto
|
0.004 s | 5 KBi |
#4 |
Correcto
|
0.005 s | 5 KBi |
#5 |
Correcto
|
0.006 s | 7 KBi |
#6 |
Correcto
|
0.007 s | 6 KBi |
#7 |
Correcto
|
0.008 s | 51 KBi |
#8 |
Correcto
|
0.117 s | 10 KBi |
#9 |
Correcto
|
0.362 s | 7 KBi |
#10 |
Correcto
|
0.36 s | 9 KBi |
#11 |
Correcto
|
0.352 s | 7 KBi |
#12 |
Correcto
|
0.339 s | 8 KBi |
#13 |
Tiempo límite excedido
|
0.318 s | 7 KBi |
#14 |
Correcto
|
0.367 s | 22 KBi |
package main import ( "fmt" ) func solve(a []int, p, q int) { sum := 0 for i := p; i <= q; i++ { sum += a[i] } fmt.Println(sum) } func main() { var n int _, err := fmt.Scanf("%d", &n) if err != nil { panic(err) } a := make([]int, n) for i := 0; i < n; i++ { _, err := fmt.Scanf("%d", &a[i]) if err != nil { panic(err) } } var c int _, err = fmt.Scanf("%d", &c) if err != nil { panic(err) } for k := 0; k < c; k++ { var p, q int _, err := fmt.Scanf("%d %d", &p, &q) if err != nil { panic(err) } solve(a, p, q) } }