Files

Visualizer.jar
CoalMiningVis.java
To use the visualizer for testing your solution locally, you'll have to adopt your solution to read 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 rows of the mine H. Then you should read H lines, each corresponds to one element from the mine array. Then you should read an integer T which represents the number of trucks. Then you should read T integers that represents the truckX array. Then you should read another T integers that represents the truckY array. Finally you should read another integer C which represents the truck capacity.

Finally, you should output an integer L that represents the number of time steps you used. Then you should output L lines, each line represents the moves of all the trucks in one time step. Remember to flush the standard out.

To do this, you should implement the following pseudocode:
    main
    {   
        H = int(readLine())
        for (i=0; i<H; i++)
            mine[i] = readLine()
        T = int(readLine())
        for (i=0; i<T; i++)
            truckX[i] = int(readLine())
        for (i=0; i<T; i++)
            truckY[i] = int(readLine())
        C = int(readLine())
        ret = gather(mine, truckX, truckY, C)
        printLine(ret.size)
        for (i=0; i<ret.size; i++)
            printLine(ret[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 "-novis" option to disable the visualization. The "-delay" option will slow down the visualizer. "-delay 10" will add a delay of 10ms between each time step.

White cells represent open spaces in the mine; your trucks can drive here. Black cells represent solid coal. Gray cells represent loose coal that can be picked up. Orange cells represent solid rock which can"t be moved. Green cells represent shafts. Blue frames represent trucks. The filled gray part inside the blue frame indicates how loaded the truck is. The frame becomes red when the truck has been fully loaded.