Files
Usage
To use the visualizer for testing your solution locally, you'll have to adopt your solution to read
the parameters from standard in and write the output to standard out.
This doesn't affect the functioning of the solution you submit to our server.
Your program should first read the number of inner nodes in the chain N=L-1
and N integers representing the elements of directions
(in order, each integer in a separate line).
After this, you should print the number of elements in the return from mirrorSequence
and the elements of the return, each integer in a separate line.
Remember to flush standard output after writing to it.
To do this, you should implement the following pseudocode:
N = int(readLine())
for (i=0; i<N; i++)
directions[i] = int(readLine())
int[] seq = mirrorSequence(directions)
printLine(seq.length())
for (i=0; i<seq.length(); i++)
printLine(seq[i])
flush(stdout)
To run the visualizer with your solution, you should run:
java -jar Visualizer.jar -exec "<command>" -seed <seed>
Here, <command> is the command to execute your program,
and <seed> is seed for test case generation.
Additionally you can use the following options:
-
-vis to turn on the visualization (by default it is turned off).
-
-delay <ms> to set the delay between visualizing mirror operations, in milliseconds.
-
-size <S> to set the segment length to S pixels.
-
-manual to rearrange the chain yourself. Green and blue squares show start and end nodes
of the polymer, red square shows node of last mirror operation.
To perform a mirror operation, left-click the mirror node.
Right-click on the image to adjust the image so that is shows the polymer chain centered.
Current score of the chain is shown in the top left corner.
Finally, you can print any debug information of your solution to standard error,
and it will be forwarded to the standard out of the visualizer.