Downloads
Helpful information
In order to use the offline tester / visualizer tool 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 parameters: size of the map S, map, W, L and G.
To imitate one call of a library function, you should print '?' character followed by the name of the method in the same line,
then print the parameters of the method and flush standard out.
After each "call" written to standard out, you should read one or two lines representing the return value of the function.
Finally, print any non-'?' character (in a separate line) and flush standard out. You don't need to output the return value of your whereAmI method, as it's ignored anyways.
To do this, you should implement the following pseudocode:
string[] look()
{ printLine('?look')
flush(stdout)
string[] ret(2)
ret[0] = readLine();
ret[1] = readLine();
return ret
}
int walk(int[] shift)
{ printLine('?walk')
printLine(shift[0])
printLine(shift[1])
flush(stdout)
return int(readLine())
}
int guess(int[] coord)
{ printLine('?guess')
printLine(coord[0])
printLine(coord[1])
flush(stdout)
return int(readLine())
}
main()
{ S = int(readLine())
for (i=0; i<S; i++)
map[i] = readLine()
W = int(readLine())
L = int(readLine())
G = int(readLine())
ret = whereAmI(map, W, L, G)
printLine('!')
flush(stdout)
}
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:
-
-novis : turn off visualization.
-
-size 20 : set building size for visualization (recommended to fit large maps on the screen).
-
-delay 50 : set the delay after drawing to 50 ms.
-
-debug : print debug information during test run.
-
-twomaps : by default all visualization is shown on one map: the unseen part of the city is shown as given by the old map in dark gray and light gray colors, the seen buildings are shown in black and white with a green border if the actual color of the building matches the color on the map and a red border otherwise. With -twomaps switch, the visualization is split in two maps: the left map shows the old map of the city and the guesses done, the right map shows seen areas of the city.
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.