Sorry if I ask for something inapropiate, I am a bit new...
What the machines where Spoj is running specifications are?
I am a bit desperate with the problem ORDERS and do not know if it is possible to solve in Java.
I generate a huge test file, 50 lines 200000 elements each( code to generate this test file bellow).
My solution works in around 15 seconds(for this file), but my computer is a 2.3Mhz. I time using the "cygwin" shell command time, not internally in the Java code.
I can get a slighly better performance with a bigger initial Heap size, I use the vm properties, -Xms64m and -Xmx64m.
Is possible to do it in Java, or it is a completely hopeless task under current Spoj conditions. The situation can be that I do things wrong, what can be solved, or that it is impossible, what is a stupid situation.
The test generator.
public class Generator {
public static void main(String args[]) {
System.out.println(50);
for (int i = 0; i<50; i++) {
System.out.println(200000);
StringBuffer b = new StringBuffer();
b.append("0 1 0 ");
for (int j = 0; j < 199997; j++) {
b.append((j-(j%3))+" ");
}
System.out.println(b.toString());
}
}
Thanks