Downloads


In order to use the offline tester tool 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 method identifyGenes, this doesn't affect the way your solution works when being submitted to our server.

The tester will test your solution on one or several traits and then will calculate the overall score. In order to function properly, it needs to get access to 4 files:

  1. Genotype data file (named "genotype.dat", tester option -gen can be used to change the name).
  2. Combined SNPs file (named "comp_id.dat", tester option -comp can be used to change the name).
  3. Trait inputs file (named "trait_inputs.tsv", tester option -inp can be used to change the name). It must be in the same format as sample trait inputs file, but the first line must contain the total number of traits instead of individual names.
  4. Trait answers file (name "trait_answers.tsv", tester option -ans can be used to change the name). It must be in the same format as sample trait answers file, but the first line must contain the total number of traits instead of gene names.

You can download an archive containing these 4 data files here. These data files can be used to test on 10 example test cases. You can change the contents of "trait_inputs.tsv" and "trait_answers.tsv" to test on different traits. It is not recommended to modify the contents of "genotype.dat" and "comp_id.dat".

Your main method implementation should look like this:

  1. Read integer gLen from the standard input. It denotes the number of elements in genotype. Then read gLen strings: genotype[0], genotype[1], ..., genotype[gLen-1].
  2. Read integer tLen. If it is 0, stop execution, otherwise proceed to step 3.
  3. tLen denotes the number of elements in traitData. Read tLen integers: traitData[0], traitData[1], ..., traitData[tLen-1].
  4. Create an instance of your solution class file and call identifyGenes passing genotype and traitData as parameters. Let ret be the return value.
  5. Print retLen, the number of elements in ret, to the standard output. Then print elements ret[0], ret[1], ..., ret[retLen-1], in this exact order. Flush the standard output.
  6. Proceed to step 2.

Each integer or string that you need to read will be located in a separate line. Each integer or string that you need to print must be located in a separate line.

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

	gLen = int(readLine())
	for (i = 0, 1, ..., gLen-1) {
		genotype[i] = readLine()
	}

	while (true) {
		tLen = int(readLine())
		
		if (tLen == 0) {
			break
		}

		for (i = 0, 1, ..., tLen-1) {
			traitData[i] = int(readLine())
		}

		ret = identifyGenes(genotype, traitData)

		printLine(length(ret))
		for (i = 0, 1, ..., length(ret)-1) {
			printLine(ret[i])
		}
		flush(stdout)
	}

In order to run the tester, you can use the following command:

java -jar Tester.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 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.