Downloads


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

Each number you read or write must be located in a separate line. Make sure to flush the standard output after you have written any data to it.

To simulate a call to init, you should read two integers customQueries and contestLength. Once done, pass this data to your implementation of init. Nothing should be printed back for this call.

To simulate a call to nextOneMinute, you should read 8 numbers numVMs[0], numVMs[1], numOperational[0], numOperational[1], currentPrices[0] (floating point), currentPrices[1] (floating point), submissions[0], submissions[1]. Once done, pass this data to your implementation of nextOneMinute and let ret be the return value. Print integers ret[0], ret[1] and ret[2] (return value always contains 3 elements in any valid implementation).

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

    customQueries = parseInt(readLine())
    contestLength = parseInt(readLine())

    init(customQueries, contestLength)

    for (t=0; t < contestLength; t++)
        numVMs[0] = parseInt(readLine())
        numVMs[1] = parseInt(readLine())
        numOperational[0] = parseInt(readLine())
        numOperational[1] = parseInt(readLine())
        currentPrices[0] = parseDouble(readLine())
        currentPrices[1] = parseDouble(readLine())
        submissions[0] = parseInt(readLine())
        submissions[1] = parseInt(readLine())

        ret = nextOneMinute(numVMs, numOperational, currentPrices, submissions)

        printLine(ret[0])
        printLine(ret[1])
        printLine(ret[2])

        flush(stdout)

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

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

<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 parameter -seed <seed>. This sets the seed used for test case generation. The default value of this parameter is 1.

If you would like to leave only score output (and suppress the output of average/maximum latencies), you can use the parameter -silent.

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 tester.

For more information on using offline testers, please check the following recipe draft from TopCoder Cookbook. Note that this is not a troubleshooting thread, please use the match forum for questions instead.