Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.004 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 1 KBi |
#6 |
Correcto
|
0.004 s | 1 KBi |
#7 |
Correcto
|
0.004 s | 1 KBi |
#8 |
Correcto
|
0.26 s | 1 KBi |
#9 |
Tiempo límite excedido
|
0.582 s | 1 KBi |
#10 |
Tiempo límite excedido
|
0.581 s | 1 KBi |
#11 |
Tiempo límite excedido
|
0.813 s | 1 KBi |
#12 |
Tiempo límite excedido
|
0.665 s | 15 KBi |
#13 |
Correcto
|
0.027 s | 1 KBi |
#14 |
Tiempo límite excedido
|
0.61 s | 1 KBi |
/* Code by Eduardo Vega */ #include <stdio.h> #include <stdlib.h> int main () { long int size = 0, num_consultas = 0, consulta1 = 0, consulta2 = 0, num = 0, suma = 0, i, j; long int *array = NULL; /* Get size and dynamically allocate array */ scanf("%li", &size); array = malloc(sizeof(long int) * size); /* Fill the array with input numbers */ for (i = 0; i < size; i++) { scanf("%li", &num); array[i] = num; } /* Get the number of queries */ scanf("%li", &num_consultas); /* Iterate and get the index queries */ for (i = 0; i < num_consultas; i++) { scanf("%li %li", &consulta1, &consulta2); for (j = consulta1; j <= consulta2; j++) suma += array[j]; printf("%li\n", suma); suma = 0; } free(array); return 0; }