Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.003 s | 1 KBi |
#2 |
Correcto
|
0.003 s | 1 KBi |
#3 |
Correcto
|
0.003 s | 1 KBi |
#4 |
Correcto
|
0.004 s | 2 KBi |
#5 |
Correcto
|
0.002 s | 1 KBi |
#6 |
Correcto
|
0.004 s | 1 KBi |
#7 |
Correcto
|
0.003 s | 1 KBi |
#8 |
Correcto
|
0.003 s | 1 KBi |
#9 |
Correcto
|
0.004 s | 4 KBi |
#10 |
Correcto
|
0.004 s | 1 KBi |
#11 |
Correcto
|
0.004 s | 2 KBi |
#12 |
Correcto
|
0.002 s | 1 KBi |
#13 |
Correcto
|
0.003 s | 1 KBi |
#14 |
Correcto
|
0.05 s | 9 KBi |
#15 |
Correcto
|
0.047 s | 9 KBi |
#16 |
Correcto
|
0.051 s | 9 KBi |
#17 |
Correcto
|
0.048 s | 9 KBi |
#18 |
Correcto
|
0.045 s | 9 KBi |
#19 |
Correcto
|
0.05 s | 8 KBi |
#20 |
Correcto
|
0.055 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] + array[i]; for(i = 1; i < size; i++) { if (arr_aux[i] < 0 && arr_aux[i - 1] > 0) { printf("%li\n", i); free(array); return 0; } arr_aux[i] = arr_aux[i - 1] + array[i]; } printf("Impossible\n"); free(array); return 0; }