Files

availableResources
requiredResources
missions
Offline Tester
Offline Tester Source

Offline Tester Usage

To use the offline tester, you must have Java installed and working on a command line. You should then modify your program to read input from standard in and write output to standard out. Note that this does not affect the code you will submit to TopCoder, which should still implement the method described in the problem statement.

The input will be given to you one argument at a time. The string arrays will be given as a line containing a single integer N, representing the size of the array, followed by the N lines representing the elements. The two double parameters will simply be given on lines by themselves. You should output your string array in the same format: the length on a line by itself, followed by the contents, one element per line. Assuming you have implemented the getMedkit method, your code to interface with the offline tester may look something like this:
  readStringArray(){
    length = parseInt(readLine());
    ret = string[length];
    for(i = 0; i < output.length; i++){
      ret[i] = readLine();
    }
  }
  main() {
    availableResources = readStringArray();
    requiredResources = readStringArray();
    missions = readStringArray();
    P = parseDouble(readLine());
    C = parseDouble(readLine());
    output = getMedkit(availableResources, requiredResources, missions, P, C);
    printLine(output.length);
    for(i = 0; i < output.length; i++){
      printLine(output[i]);
    }
  }
Any debugging output you print to standard error will be forwarded to the console. You must not print debugging output to standard out, as that will confuse the testing framework which is reading your medkit from standard out. Be sure to flush your output buffers at the end of your code!

To run the tester, download the files above and place them all in the same directory, along with your executable. You can then run
java -Xmx1024M -jar Tester.jar EXEC SEED
EXEC is the executable command. If this contains a space, it must be surrounded by quotes. For example 'java -Xmx128M MySpaceMedkit'. SEED is a seed for the random number generator used to generate the details of the test case.