Challenge Overview
Problem Statement | |||||||||||||
You are researching some new anti-viral drugs, and wish to determine the optimal way to apply the medicine in a tissue sample, so that the effects of the virus are minimized. Initially, you are given the layout of the slide in String[] slide as a 2D array of cells, where each cell can be clean ('C'), dead ('X'), or infected with the virus ('V'). You are also given other parameters. int medStrength indicates the strength of the medication when it is first injected in a single cell. int killTime describes the number of units of time between a cell becoming infected and a cell dying. When a cell dies, the virus may spread to any of the four directly adjacent cells. Lastly, double spreadProb indicates the probability of each surrounding cell becoming infected. Note that the virus spread has no effect on cells that are already infected, already dead, or have a sufficient concentration of medicine. Your code should call one of three methods during each unit of time to indicate what it would like to do:
As each unit of time passes, several things will happen:
The simulation will run for at most 10000 units of time. Your solution is not allowed to perform actions after that time. After your solution returns, the simulation will continue to run until there are no longer any viral-infected cells remaining, or until 10000 units of time have elapsed from the start. The value returned from runSim() will be ignored. If your method throws any errors, or calls addMed() or waitTime() with invalid parameters, or makes calls in excess of the maximum units of time, you will score a -1 for that test case. Your raw score for a test case will be (HEALTHY_CELLS_REMAIN - MEDICINE_APPLICTIONS * 0.5) / SIM_TIME. Your combined score for all test cases will be equal to the sum of (YOURS / BEST), scaled to 1,000,000. Thus, a combined score of 1,000,000 implies a solution that has the current best score on all test cases. Diffusion ExamplesBefore: 0.00 0.00 0.00 0.00 5.00 0.00 0.00 0.00 0.00 After: 0.00 1.00 0.00 1.00 1.00 1.00 0.00 1.00 0.00 After another step: 0.40 0.60 0.40 0.60 1.00 0.60 0.40 0.60 0.40 And one more step: 0.48 0.60 0.48 0.60 0.68 0.60 0.48 0.60 0.48 | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | After test case generation, the random number generator is reseeded. Note also that, except for test cases 0..9, the test servers do not reseed the randomizer in the same manner as the visualizer. | ||||||||||||
- | A visualizer is available for this contest, the manual can be found here. | ||||||||||||
Constraints | |||||||||||||
- | Time limit is 60 seconds. | ||||||||||||
- | Memory limit is 1GB. | ||||||||||||
- | medStrength will be between 10 and 100, inclusive. | ||||||||||||
- | killTime will be between 1 and 10, inclusive. | ||||||||||||
- | spreadProb will be in the interval [0.25, 1.00). | ||||||||||||
- | The height and width of the slide will be between 15 and 100, inclusive. | ||||||||||||
- | The first five example cases have sizes which are specially determined. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
| |||||||||||||
6) | |||||||||||||
| |||||||||||||
7) | |||||||||||||
| |||||||||||||
8) | |||||||||||||
| |||||||||||||
9) | |||||||||||||
|
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2020, TopCoder, Inc. All rights reserved.