Page 1 of 1

### New Judge Online: Acepta el reto!

Posted: Thu Jun 19, 2014 6:17 pm
Hi everybody!
There's a new web where find easy problems to solve: http://www.aceptaelreto.com.
It's a spanish web for FP and university students.
I have problems like TLE and MLE in problems 146, 179, 183 and 209. Someone could help me?

### New Judge Online: Acepta el reto!

Posted: Fri Jun 20, 2014 10:33 am
PROBLEM 146 Lucky Numbers

Code: Select all

``AC``

### New Judge Online: Acepta el reto!

Posted: Fri Jun 20, 2014 10:35 am
PROBLEM 179 Windmills

Code: Select all

``AC``

### New Judge Online: Acepta el reto!

Posted: Fri Jun 20, 2014 10:39 am
PROBLEM 183 Annelids

Code: Select all

``AC``

### New Judge Online: Acepta el reto!

Posted: Fri Jun 20, 2014 10:41 am
PROBLEM 209 Daylight

Code: Select all

``````AC
``````

### Re: www.aceptaelreto.com

Posted: Tue Jun 24, 2014 9:39 pm
Try using BufferedWriter

### New Judge Online: Acepta el reto!

Posted: Wed Jun 25, 2014 7:33 pm
Thanks for your answer brianfry713, but I've tried PROBLEM 146 with BufferedOutputStream and still TLE.

The changes are there:

Code: Select all

``````AC
``````

### Re: www.aceptaelreto.com

Posted: Wed Jun 25, 2014 11:06 pm
What about Stack.remove()? You are continuosly removing intermediate elements in a vector and that is not particularly efficient because all the elements in the right side of the removed element must be moved.

This seems a Josephus problem variant, and they are usually solved using a queue where add/remove operations are supposed to be fast enough.

### New Judge Online: Acepta el reto!

Posted: Sat Aug 13, 2016 3:26 pm
Hi again everybody!!!
I have seen that people from that online judge try to solve problems from Acepta el reto!.
Could anyone of you help me with the following problems?

PROBLEM 230: TLE

Code: Select all

``````#include <stdio.h>

int i, j, numHabitantes, contador;
long diasVividos [100000];

int main(void) {
scanf("%d", &numHabitantes);
while(numHabitantes > 0) {
for(i = 0; i < numHabitantes; i++) {
scanf("%d", &diasVividos[i]);
}
for(i = 0; i < numHabitantes - 1; i++) {
for(j = i + 1; j < numHabitantes; j++) {
if(diasVividos[i] > diasVividos[j]) {
}
}
}
scanf("%d", &numHabitantes);
}
return 0;
}
``````
PROBLEM 257: WA

Code: Select all

``````#include <stdio.h>
#include <stdlib.h>

int i, j, numCasosPrueba, numPuntosControl, x, y, x1, y1, x2, y2, tiempo, parcial1, parcial2;

int main(void) {
scanf("%d", &numCasosPrueba);
for(i = 0; i < numCasosPrueba; i++) {
scanf("%d", &numPuntosControl);
scanf("%d", &x1);
scanf("%d", &y1);
tiempo = x1 + y1;
x2 = 0;
y2 = 0;
for(j = 0; j < numPuntosControl - 1; j++) {
scanf("%d", &x);
scanf("%d", &y);
parcial1 = abs(x - x1) + abs(y - y1);
parcial2 = abs(x - x2) + abs(y - y2);
if(parcial1 < parcial2) {
tiempo = tiempo + parcial1;
x1 = x;
y1 = y;
} else {
tiempo = tiempo + parcial2;
x2 = x;
y2 = y;
}
}
printf("%d\n", tiempo);
}
return 0;
}
``````
PROBLEM 261: WA

Code: Select all

``````import java.io.BufferedOutputStream;
import java.io.IOException;

public class Main {

public static void main(String[] args) throws IOException {

BufferedOutputStream salida = new BufferedOutputStream(System.out);
String[] datos;
for (i = 0; i < numCasosPrueba; i++) {
suma = Integer.parseInt(datos[0]);
if (suma == 1000) {
salida.write("PIERDE\n".getBytes());
} else if (suma == 999) {
salida.write("GANA\n".getBytes());
} else if (suma == 998) {
salida.write("GANA\n".getBytes());
} else {
salida.write("PIERDE\n".getBytes());
}
} else if (suma == 997) {
salida.write("PIERDE\n".getBytes());
} else {
if (suma % 9 == 0) {
salida.write("GANA\n".getBytes());
} else {
salida.write("PIERDE\n".getBytes());
}
} else if (suma % 9 == 1) {
salida.write("GANA\n".getBytes());
} else {
salida.write("PIERDE\n".getBytes());
}
} else if (suma % 9 == 2) {
salida.write("PIERDE\n".getBytes());
} else if (suma % 9 == 3) {
salida.write("PIERDE\n".getBytes());
} else if (suma % 9 == 4) {
salida.write("GANA\n".getBytes());
} else if (suma % 9 == 5) {
salida.write("GANA\n".getBytes());
} else {
salida.write("PIERDE\n".getBytes());
}
} else if (suma % 9 == 6) {
salida.write("PIERDE\n".getBytes());
} else if (suma % 9 == 7) {
salida.write("PIERDE\n".getBytes());
} else if (suma % 9 == 8) {
salida.write("GANA\n".getBytes());
} else {
salida.write("PIERDE\n".getBytes());
}
}

}
}
salida.flush();
salida.close();
}
}
``````
PROBLEM 343: TLE

Code: Select all

``````#include <stdio.h>
#include <string.h>

int i, j, k, l, tamanhoHorizontalMesa, tamanhoVerticalMesa, tamanhoHorizontalMatamoscas, tamanhoVerticalMatamoscas, moscasMuertas;
char moscasMesa [1000][1000];
int posiciones [8];

int main(void) {
scanf("%d", &tamanhoHorizontalMesa);
scanf("%d", &tamanhoVerticalMesa);
scanf("%d", &tamanhoHorizontalMatamoscas);
scanf("%d", &tamanhoVerticalMatamoscas);
while (tamanhoHorizontalMesa != 0 || tamanhoVerticalMesa != 0 || tamanhoHorizontalMatamoscas != 0 || tamanhoVerticalMatamoscas != 0) {
for (i = 0; i < tamanhoVerticalMesa; i++) {
scanf("%s", moscasMesa[i]);
}
for (i = 0; i <= tamanhoVerticalMesa - tamanhoVerticalMatamoscas; i++) {
for (j = 0; j <= tamanhoHorizontalMesa - tamanhoHorizontalMatamoscas; j++) {
moscasMuertas = 0;
for (k = 0; k < tamanhoVerticalMatamoscas; k++) {
for (l = 0; l < tamanhoHorizontalMatamoscas; l++) {
if(moscasMesa[i + k][j + l] == 'X') {
moscasMuertas++;
if (moscasMuertas > 7) {
break;
}
}
}
}
posiciones[moscasMuertas]++;
}
}
printf("%d", posiciones[0]);
posiciones[0] = 0;
for (i = 1; i < 8; i++) {
printf(" %d", posiciones[i]);
posiciones[i] = 0;
}
printf("\n");
scanf("%d", &tamanhoHorizontalMesa);
scanf("%d", &tamanhoVerticalMesa);
scanf("%d", &tamanhoHorizontalMatamoscas);
scanf("%d", &tamanhoVerticalMatamoscas);
}
return 0;
}
``````
Thank you in advance.