In order to use the offline tester / visualizer tool for testing your solution locally, you'll have to modify your solution
by adding the main method that interacts with the tester / visualizer via reading data from standard input and
writing data to standard output. As long as you do not change the implementation of method choosePolygons, this
doesn't affect the way your solution works when submitted to our server.
To simulate a single test case, your program should first read the number of elements in points Np. After this it should read Np elements of points, one per line.
Finally, read the number of polygons N. After the calculations are done, print the number of elements
in your return, followed by elements themselves, one per line.
Finally, flush standard out.
To do this, you should implement the following pseudocode:
Np = int(readLine())
for (i=0; i < Np; i++)
points[i] = int(readLine())
N = int(readLine())
ret = choosePolygons(points, N)
for (i=0; i < ret.size(); i++)
To run the tester with your solution, you should run:
java -jar Tester.jar -exec "<command>" -seed <seed>
Here, <command> is the command to execute your program,
and <seed> is seed for test case generation.
If your compiled solution is an executable file, the command
will be the full path to it, for example, "C:\TopCoder\solution.exe" or
"~/topcoder/solution". In case your compiled solution is to be run
with the help of an interpreter, for example, if you program in Java,
the command will be something like "java -cp C:\TopCoder Solution".
Additionally you can use the following options:
Finally, you can print any debug information of your solution to standard error,
and it will be forwarded to the standard out of the tester.
-vis to turn on visualization.
-nostrict to allow score to be calculated even if some of your polygons are invalid. The default behavior (when this
option is absent) is exactly as written in the problem statement, i.e., you score will be 0 if at least one of your
polygons is invalid. If this option is present, the score will be calculated only based on valid polygons;
any invalid polygons will be ignored for the purpose of score calculation.
-manual to allow editing the polygons by hand. If combined with -exec option, you will be able to edit the polygons your
solution returns; otherwise you will have to create all polygons from the scratch. To create a new polygon, click on any
unused point and proceed to editing it. To edit an existing polygon, select it by clicking on any point
it contains. When editing a polygon, it will be highlighted in blue color; the last vertex will have a lighter color than
the other ones. You can add a vertice to the polygon after its last vertice by clicking any unused point, or delete the last vertice by
clicking on it. You can't edit vertices except for the last one. To delete the polygon you're editing, click "Del Poly" button. To add
the polygon you're editing to the list of polygons, click "Add Poly" button. This will validate the polygon, add it to the list of polygons if
it is valid, or print error message if it is not. Once you're happy with the polygons you have, click "Submit" button.
-debug to turn on extra information for manual mode: detailed reports on polygons editing and points indices on the image.
For more information on using visualizers, please check the following recipe draft
from TopCoder Cookbook (a Google Doc copy available here). Note that this is not a troubleshooting thread, please use the match forum for questions instead.