Downloads


In order to use the visualizer tool for testing your solution locally, you'll have to modify your solution by adding the main method that interacts with the visualizer via reading data from standard input and writing data to standard output. Since you do not change the implementation of methods init and processOrder, this doesn't affect the way your solution works when being submitted to our server.

To simulate init call on server side, your program should read the following data from standard input in this exact order (each integer/string is located in a separate line):

Once this data is read, pass it to your implementation of init method.

To simulate processOrder call on server side, your program should read the following data from standard input in this exact order (each integer/string is located in a separate line):

Once this data is read, pass it to your implementation of processOrder method and let ret be the return value. Write the following data to standard output in this exact order (each integer in a separate line): Make sure to flush the standard output after all this data is written.

In other words, you should implement the following pseudocode in the main method of your solution:

    H = int(readLine())
    for (i=0; i < H; i++)
        plate[i] = readLine()
    K = int(readLine())
    orderCnt = int(readLine())

    init(plate, K, orderCnt)

    for (orderId=0; orderId < orderCnt; orderId++) {
        H = int(readLine())
        for (i=0; i < H; i++)
            figure[i] = readLine()
        income = int(readLine())
        
        ret = processOrder(figure, income)

        printLine(ret.length)
        for (i=0; i < ret.length; i++)
            printLine(ret[i])

        flush(stdout)
    }

In order to run the visualizer, you should use the following command:

java -jar Visualizer.jar -exec "<command>"

Here <command> is the command you would use to execute your solution. If your compiled solution is an executable file, the command will just 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 (all are optional):

You can print any debug information of your solution to the standard error stream and it will be forwarded to the standard output of the visualizer.

As a final piece of information, here's is the meaning of cell colors used by the visualizer:

For more information on using visualizers, please check the following recipe draft from TopCoder Cookbook.