Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 1 KBi |
#2 |
Correcto
|
0.003 s | 1 KBi |
#3 |
Correcto
|
0.003 s | 1 KBi |
#4 |
Correcto
|
0.003 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 1 KBi |
#6 |
Correcto
|
0.004 s | 1 KBi |
#7 |
Correcto
|
0.003 s | 1 KBi |
#8 |
Correcto
|
0.004 s | 1 KBi |
#9 |
Correcto
|
0.003 s | 1 KBi |
#10 |
Incorrecto
|
0.003 s | 1 KBi |
#11 |
Incorrecto
|
0.003 s | 1 KBi |
#12 |
Correcto
|
0.003 s | 1 KBi |
#13 |
Incorrecto
|
0.004 s | 1 KBi |
#14 |
Incorrecto
|
0.052 s | 9 KBi |
#15 |
Correcto
|
0.044 s | 9 KBi |
#16 |
Correcto
|
0.048 s | 9 KBi |
#17 |
Incorrecto
|
0.058 s | 9 KBi |
#18 |
Correcto
|
0.043 s | 9 KBi |
#19 |
Incorrecto
|
0.048 s | 9 KBi |
#20 |
Incorrecto
|
0.056 s | 9 KBi |
/* Code by Eduardo Vega */ #include <stdio.h> #include <stdlib.h> int main () { long size = 0, num = 0, sum_right = 0, sum_left = 0, i; long *array = NULL; long *arr_aux = NULL; scanf("%li", &size); array = malloc(sizeof(long int) * size); arr_aux = malloc(sizeof(long int) * size); for (i = 0; i < size; i++) { scanf("%li", &num); array[i] = num; arr_aux[i] = num; } for (i = size - 2; i > 0; i--) arr_aux[i] += arr_aux[i + 1]; for(i = 1; i < size; i++) { if (arr_aux[i] < 0 && arr_aux[i - 1] > 0) { printf("%li\n", i); free(array); return 0; } } printf("Impossible\n"); free(array); return 0; }