Register
Submit a solution
The challenge is finished.

Challenge Overview

Problem Statement

    A rectangular vessel is divided in two equal parts with a vertical partition. The vessel contains particles which are randomly distributed between two parts and move in different directions. Particles don't interact with each other. Particles bounce off the walls of the vessel and the partition obeying the law of reflection (angle of incidence equals angle of reflection).

You move a mobile opening of fixed width D in the partition. If the particle was to bounce off the partition within the opening, it will move through the opening to another part of the vessel instead.

Your goal is to separate red and blue particles into different parts of the vessel.

Input Format

You will be given the width W and height H of the vessel, the width of the opening D and the list of the particles' parameters particles. Element i of particles will be formatted as "C X Y DX DY", where
  • C will be "R" or "B" for red or blue,
  • X and Y will be the x and y coordinates of the particle at time 0, in units,
  • DX and DY will be the x and y components of the particle's velocity at time 0, in units per second. During one second the particle's coordinates change by (DX, DY), unless it hits a wall or the partition and changes direction.
See the picture for clarification of coordinates used in input and output. The partition starts at the very top, from Y = 0 to D.

Output Format

Your method will return a list of moves to perform. You may slide the opening in the partition up or down at a rate of speed. If you try to slide the opening outside of the vessel, it will simply stop when it reaches an edge. You may also close the opening, ending the simulation. Each element of your return should be formatted as one of
  • UP <duration>
  • DOWN <duration>
  • STAY <duration>
  • CLOSE
The moves you return will be executed in the order you specify them. Thus, a return of {"DOWN 10", "STAY 2", "UP 4.3"} with speed = 5 will result in the partion first sliding down to leave a gap from 50 to 50+D, then staying there for 2 seconds, and finally sliding up to leave an opening from 28.5 to 28.5+D. The partition slides continuously, so at time 5, for instance, it will span from 25 to 25+D. The simulation will be run till time=1000 or a CLOSE command, at which point you will be scored. If you do not specify moves through time=1000 and do not issue a CLOSE command, the gap will simply stay in the last position you move it to.

Scoring

Your score for a test case will be based on how well you separate the red particles from the blues ones. If LR and LB are the number of red and blue particles in the left side of the vessel, while RR and RB are the numbers for the ride side, your score will be the entropy of the particles:

1 + (LR lg (LR / (LR + LB)) + LB lg (LB / (LR + LB)) + RR lg (RR / (RR + RB)) + RB lg (RB / (RR + RB)))/(LR+LB+RR+RB)

where lg(x) is the logarithm of x with base 2. Note also that we treat 0 lg (0) as evaluating to 0 (which it does if you take the limit). Thus a perfect separation will score a 1, while complete disorder (LR=LB=RR=RB) will score a 0.

Your final score will be computed by taking the sum over all test cases of YOU/BEST, where YOU is your score for that test case, and best is the best score anyone was able to achieve for that test case.

Test case generation

All parameters are chosen uniformly at random.

Visualizer

A visualizer, which includes manual play, is available at http://www.topcoder.com/contest/problem/MaxwellDemon/vis.html.
 

Definition

    
Class:MaxwellDemon
Method:moveOpening
Parameters:int, int, int, int, String[]
Returns:String[]
Method signature:String[] moveOpening(int W, int H, int D, int speed, String[] particles)
(be sure your method is public)
    
 

Notes

-Invalid return results in a score of 0. This includes returns with negative durations, or improper formatting. You may also not have more than 100,000 elements in your return.
-The behavior of particles that bounce extremely close to the edge of the opening is undefined -- they may bounce or they may not, depending on the details of the floating point math being done. More specifically, a particle which would hit exactly on the edge of the opening should pass through the openning. However, if you move the opening for non-integral durations, it may end up off by a small amount from where you expect it, causing the particle to bounce instead of pass through.
-The memory limit is 1024 MB and the time limit is 20 seconds (which includes only time spent in your code).
-There are 10 example test cases and 100 full submission test cases.
-Your score will be evaluated a moment after the end of the simulation. Thus a particle which ends with X=0 will move slightly to one side or the other.
 

Constraints

-W will be between 10 and 100, inclusive.
-H will be between 40 and 200, inclusive.
-D will be between 10 and floor(H/4), inclusive.
-speed will be between 1 and 10, inclusive.
-The number of particles will be between 10 and 200, inclusive.
-For each particle: X will be between -W+1 and -1 or between 1 and W-1, inclusive; Y will be between 1 and H-1, inclusive; DX and DY will be between -5 and 5, inclusive, though no DX will be 0.
 

Examples

0)
    
"1"
Returns: 
"seed = 1
W = 89, H = 70, D = 13, speed=6
179 particles:
  R 4 36 -5 2,
  B -30 61 3 -3,
  R -43 53 -3 -2,
  R -51 48 4 3,
  R -33 54 -5 5,
  B 26 13 2 -2,
  R -30 31 5 0,
  B -39 61 -3 -5,
  R -25 67 -2 -3,
  B 38 16 1 -4,
  B -43 26 -4 4,
  R 72 5 5 -4,
  B -68 56 -3 5,
  B -63 58 2 3,
  B -13 45 -3 -5,
  R -30 27 -4 1,
  B 6 10 2 -4,
  R -50 23 -4 -3,
  R -19 47 -3 2,
  R 45 53 2 -5,
  B 56 35 3 -5,
  R -49 47 -5 -2,
  B -8 58 2 -4,
  B -53 5 -3 -2,
  B -6 3 -4 -5,
  R 7 21 5 2,
  B 14 44 -2 0,
  B -47 31 1 -5,
  B 25 29 -3 2,
  B -54 60 -1 4,
  R -54 2 -1 0,
  B -26 27 3 4,
  B 81 36 5 5,
  R 84 11 1 0,
  R 28 31 3 5,
  R -35 66 5 -2,
  R 81 65 1 -3,
  B 64 16 2 3,
  R -17 48 -4 -2,
  B -24 67 1 -5,
  B -47 47 5 -1,
  B 88 32 -4 3,
  R 87 9 2 5,
  R 63 40 -1 0,
  B 2 36 -5 -4,
  R -12 12 -5 -4,
  R 39 40 -3 -4,
  R -83 33 -2 5,
  B -39 20 5 -3,
  R -72 59 5 -5,
  R -38 11 2 3,
  R 35 28 -5 0,
  R -53 50 4 2,
  B -52 4 4 -4,
  B 87 27 1 3,
  B -1 33 -5 -1,
  R 16 43 -4 3,
  B 81 28 -5 4,
  B -32 45 4 -3,
  R 63 49 -2 2,
  R -12 21 5 2,
  B 57 32 -4 1,
  R 51 9 -5 2,
  R -50 12 -4 4,
  B -40 60 -2 -4,
  R -50 66 3 4,
  B 2 60 1 2,
  B -60 41 2 0,
  B -67 14 2 2,
  B -25 55 -4 0,
  B -54 45 -4 -5,
  B 59 10 1 3,
  B 46 21 2 0,
  R -67 13 1 -5,
  R -84 25 -2 3,
  R 17 5 3 2,
  B -73 47 -2 5,
  B 12 16 -4 -2,
  R 74 34 4 2,
  R 34 67 -4 -2,
  B 69 5 -5 -5,
  B -70 20 3 2,
  R 2 61 2 3,
  R -50 16 -1 -2,
  R -69 42 -1 -1,
  B -39 27 5 -2,
  R -8 15 4 -3,
  B -88 30 -5 0,
  R 40 52 3 -1,
  B -22 45 -4 4,
  B 38 2 4 -2,
  B 22 60 -4 5,
  R -49 30 -5 3,
  R 66 61 1 5,
  B -66 30 -3 0,
  B 38 1 1 2,
  B 52 28 -2 -5,
  B -74 56 -1 -2,
  B -53 29 5 -3,
  B 46 32 3 0,
  B -61 20 2 3,
  B 1 60 -2 0,
  B -28 23 -1 1,
  R -34 32 -3 5,
  R -43 34 -4 2,
  R 65 15 4 -3,
  R -71 16 2 1,
  R -21 49 4 -5,
  R 66 68 -3 -2,
  B -88 65 -1 -5,
  B -83 32 1 1,
  R -79 18 5 -5,
  R -36 64 3 -1,
  B -53 48 -3 3,
  B 79 15 3 3,
  B -49 64 3 -5,
  B -16 1 5 3,
  B -51 32 -3 2,
  R -8 52 -1 5,
  R 44 31 3 1,
  B 8 16 3 -2,
  R 63 67 -5 -4,
  B 56 16 -1 -1,
  R -25 3 1 -1,
  R 82 27 1 0,
  R -21 30 5 -2,
  B -13 59 4 4,
  R 27 63 2 2,
  R 69 21 2 3,
  B -15 36 -2 5,
  R -43 49 -2 -2,
  B 35 30 2 -5,
  B 82 45 5 -4,
  B 14 38 3 -2,
  R -65 52 3 2,
  B 39 46 5 -4,
  B -25 46 2 -2,
  B -27 26 2 1,
  B 7 23 -2 2,
  B 83 49 3 2,
  R 46 4 2 4,
  R -1 59 4 3,
  R 54 39 2 4,
  B 21 20 -3 2,
  R 85 35 4 2,
  R 31 58 4 4,
  B -32 47 5 3,
  B 75 67 4 2,
  B 18 66 2 4,
  R 50 40 1 -3,
  R -52 42 -1 1,
  R -51 64 4 3,
  R -7 33 -3 3,
  B 60 52 -1 -1,
  R -64 38 5 -3,
  R 83 27 -1 -3,
  R 39 13 3 2,
  R 15 32 -5 3,
  R -77 49 5 -4,
  B -9 34 1 0,
  R -17 53 -2 1,
  B 70 51 -3 -3,
  B 2 32 -1 0,
  B -74 62 -3 3,
  B 44 53 2 -1,
  B 31 69 4 5,
  R 15 1 5 -4,
  R 31 7 1 5,
  R -78 61 -5 -5,
  R -22 28 -4 2,
  R -19 46 -5 2,
  B 2 49 1 -5,
  B -75 26 1 2,
  R 27 4 4 -2,
  R 75 65 -1 -5,
  B 11 48 -3 -5,
  B -40 32 1 5,
  R 44 41 -3 5,
  B -75 53 3 -3"
1)
    
"2"
Returns: 
"seed = 2
W = 23, H = 45, D = 10, speed=6
101 particles:
  R 14 25 2 -4,
  B -1 40 -5 4,
  R 21 11 -5 5,
  B -14 16 1 4,
  B 1 3 -5 0,
  B 17 13 -5 0,
  B -17 13 -5 0,
  R 7 33 3 2,
  B 11 35 4 -3,
  B 21 4 -3 3,
  B -22 32 5 -4,
  B -19 23 4 2,
  B -13 25 3 3,
  R 20 40 3 -5,
  R -10 24 4 -4,
  B 9 6 -5 4,
  R -2 20 -3 -3,
  R -18 21 2 2,
  B -19 13 -4 -5,
  B -22 16 -2 -4,
  R -1 30 1 2,
  R 19 16 3 -3,
  R -3 10 5 -2,
  B -4 40 2 1,
  R 15 35 5 4,
  R 3 31 3 4,
  B -14 14 -4 3,
  B 14 11 -4 -4,
  B -3 12 -4 -3,
  R 19 9 1 1,
  B 3 7 4 -5,
  B 5 2 -1 -2,
  B 4 3 4 -1,
  R 11 14 3 4,
  B 3 33 -5 -2,
  R -21 30 3 -4,
  R 3 15 -2 4,
  B 4 9 4 3,
  B -22 14 -2 -1,
  R 17 21 3 -1,
  B 13 1 4 5,
  R 1 32 -3 3,
  B -9 34 -5 -3,
  R 5 37 -3 0,
  B 13 26 1 -2,
  B -3 7 1 -3,
  B 8 43 -3 -4,
  B 5 13 1 3,
  R 18 4 5 -1,
  B 17 30 -3 -3,
  B 7 7 -2 -1,
  B 6 25 3 -2,
  R -2 6 5 1,
  R 6 14 4 -5,
  R -20 44 2 -5,
  B 14 10 2 3,
  R -16 20 -1 3,
  R 19 16 1 3,
  R 7 20 3 -4,
  R 19 26 -4 3,
  B 22 44 -4 2,
  B -10 44 1 3,
  B 2 20 -1 3,
  B -13 44 3 -1,
  B -12 41 2 -5,
  B 22 38 -1 -2,
  B 7 39 -3 3,
  B 14 33 -2 3,
  B 11 22 4 -2,
  B 2 16 -5 2,
  R -2 20 -2 4,
  B -5 3 5 4,
  B 18 34 5 -2,
  R 17 14 4 -4,
  R -4 9 3 -5,
  R 18 2 -3 1,
  B -17 28 -4 -5,
  B -13 16 5 2,
  B -14 39 5 -5,
  B 7 16 1 5,
  R -11 26 4 -5,
  B 22 2 1 5,
  R 1 20 4 3,
  B 2 24 1 0,
  R 1 1 3 -1,
  R 7 11 -4 4,
  B 20 44 1 5,
  B -20 17 5 -5,
  R -3 2 1 -1,
  R -3 13 1 -2,
  R -10 6 3 1,
  R -7 8 -1 -3,
  B -6 8 1 2,
  B 11 24 5 0,
  R -3 33 4 -5,
  R 1 36 -5 4,
  R -14 37 5 -2,
  B 2 30 -2 3,
  B -14 29 1 5,
  R 8 26 2 -4,
  R 14 7 3 -2"
2)
    
"3"
Returns: 
"seed = 3
W = 99, H = 199, D = 22, speed=9
71 particles:
  R 81 155 -4 -5,
  B 67 23 -5 -1,
  R 16 103 5 -4,
  R 92 55 -1 -1,
  R -51 95 5 4,
  B 58 124 -5 -4,
  R 22 196 3 5,
  B -50 166 1 -1,
  R 79 183 1 1,
  B -74 69 -1 -3,
  R -25 48 3 1,
  B 63 184 -3 -3,
  R -98 190 -3 2,
  R 66 138 -5 -3,
  R 28 24 -3 -3,
  B -60 80 2 2,
  R -57 73 -3 4,
  R -30 46 -1 5,
  B -82 74 -2 2,
  R 22 24 -3 -5,
  B -32 112 -1 -1,
  B 41 81 1 2,
  R -11 75 2 -3,
  B -70 8 -3 -1,
  R -95 170 5 -1,
  R -60 7 2 -3,
  R -2 10 -2 5,
  B -44 173 -2 5,
  R -81 16 3 -3,
  B -22 173 -3 0,
  B 25 14 -4 4,
  B -71 100 -1 3,
  B 31 32 -3 0,
  B 34 124 5 1,
  B 63 133 1 -2,
  R -35 66 -4 1,
  B -3 101 5 1,
  B 11 182 -2 0,
  B -2 33 4 3,
  B 41 51 3 -4,
  R 15 147 -3 -5,
  R -44 150 3 -3,
  B -57 115 -5 3,
  R -65 166 4 5,
  R 90 148 -3 -5,
  B -38 37 -2 -4,
  R -77 56 -1 -1,
  R -70 79 -1 0,
  R -24 39 3 5,
  B -21 7 5 -4,
  B -4 102 -2 4,
  R 77 61 -1 2,
  R 74 51 2 2,
  B 78 56 4 3,
  R -41 29 -4 3,
  R 66 57 3 -4,
  B -84 116 3 -2,
  B 75 71 -1 2,
  R -36 126 -2 3,
  R -87 20 -4 -3,
  R -50 98 -4 -3,
  R 97 183 3 -4,
  R -4 164 3 -4,
  R -70 181 -4 -5,
  R 48 175 -2 -5,
  R 31 51 1 2,
  B 89 64 4 -4,
  B 41 183 2 1,
  R -70 145 -1 0,
  R 88 99 1 -5,
  B -23 154 -5 2"
3)
    
"4"
Returns: 
"seed = 4
W = 52, H = 169, D = 35, speed=3
193 particles:
  B 34 86 2 5,
  R -1 115 3 0,
  R 39 123 2 0,
  B 33 108 -5 -1,
  R -14 88 -4 5,
  R -48 153 5 -3,
  R 23 69 1 1,
  B 16 166 1 1,
  R 14 47 2 2,
  R -40 77 -5 0,
  R -4 25 -3 -2,
  B -14 67 -1 -5,
  R -44 9 4 -4,
  R 33 22 -5 3,
  R 31 93 -5 -5,
  B -34 8 4 3,
  R -46 30 -1 -5,
  B 46 52 -3 -5,
  R -25 127 4 2,
  R 20 99 4 0,
  R 5 43 1 -1,
  R 43 156 -2 -1,
  B 49 10 -5 3,
  B 9 160 -1 5,
  B -34 6 3 -4,
  B 28 29 3 3,
  R -7 119 -3 -3,
  B -48 121 -1 2,
  R -15 55 -4 4,
  B -47 159 -3 -2,
  B 24 139 5 4,
  R 22 144 -5 -1,
  B -50 4 -5 2,
  B 8 140 5 -5,
  R -41 47 3 -4,
  R 27 109 -4 3,
  B 11 151 1 2,
  R 19 133 5 -2,
  R 49 151 -5 -5,
  R -8 151 2 1,
  R 20 32 5 4,
  B -36 152 -4 -3,
  B -51 38 -4 3,
  R 8 19 -1 4,
  R 8 46 -3 -1,
  B 23 166 -1 0,
  R -17 119 3 0,
  B -26 121 -2 -2,
  R -49 14 -1 1,
  B -46 12 5 -1,
  R -31 17 -1 3,
  R 41 123 4 -3,
  B -45 23 -2 0,
  B -28 103 1 -3,
  B 10 10 -5 -4,
  R 30 166 -4 4,
  R 5 70 -5 5,
  B -2 46 4 5,
  B 6 49 -2 -1,
  R 20 156 -2 3,
  R 26 165 1 -3,
  R 41 28 -4 2,
  R 28 75 1 -3,
  B -6 136 1 -1,
  R -35 28 3 0,
  B -34 44 -1 -1,
  B -5 6 2 4,
  R 13 57 3 -2,
  B -29 168 -1 -2,
  B -11 142 -5 4,
  R -32 130 -1 0,
  B -7 33 2 0,
  R -5 138 -4 5,
  B 35 82 -5 -2,
  R -20 103 -1 1,
  B 10 166 1 3,
  R -5 115 -1 -1,
  R 26 45 -5 5,
  R 10 41 5 4,
  R -12 39 -3 2,
  R -8 2 4 -1,
  R 15 78 -2 0,
  B -34 4 4 -5,
  B -17 17 -4 -4,
  R 3 143 3 4,
  R 7 2 -5 -1,
  R 26 167 5 -5,
  R -21 34 2 -4,
  B -26 98 1 5,
  B -28 115 1 2,
  R -17 109 3 4,
  B -30 104 1 1,
  R 25 163 -5 4,
  B 11 62 -2 -3,
  B -8 99 -2 2,
  R -42 74 2 2,
  R 15 132 2 3,
  R 19 141 4 5,
  B -24 139 2 3,
  B 29 65 5 -3,
  B 45 129 2 0,
  B 8 14 -1 4,
  R -8 123 -5 -3,
  B -45 124 -4 1,
  B 23 59 4 0,
  B 1 50 3 0,
  B 51 61 -3 4,
  R -21 132 -1 1,
  R 27 145 -1 3,
  B 46 129 -2 2,
  R -34 103 -3 -4,
  B 44 1 4 1,
  R -50 10 2 1,
  B -37 103 -3 4,
  B 9 69 -5 1,
  B -25 139 -4 -3,
  R -2 115 -1 1,
  B 3 58 4 1,
  R 44 131 -5 4,
  B 3 131 1 0,
  R 12 56 -2 -3,
  R -20 101 1 -3,
  R 41 120 3 -2,
  B 46 15 -4 -1,
  R 4 97 3 -1,
  B -19 133 4 2,
  B 36 52 4 -5,
  R -2 76 -5 -2,
  B -24 145 3 3,
  R -31 159 -3 0,
  B -5 146 -3 -3,
  B 16 32 3 0,
  R 6 88 4 3,
  B 40 62 -3 4,
  R 10 80 -2 -2,
  R 23 159 -3 -4,
  R 22 62 -2 5,
  B -50 104 2 -1,
  B -20 152 -2 4,
  B -30 66 -5 -2,
  B -1 87 4 -2,
  R -14 80 -3 1,
  R -33 68 1 -1,
  B 15 101 1 3,
  B 4 165 4 4,
  B -5 106 4 -3,
  R -36 24 5 -1,
  B 5 161 -1 4,
  R -29 112 5 -2,
  B -36 3 -3 -4,
  B 38 74 5 -2,
  B 34 135 -5 -3,
  R -8 27 2 -3,
  B 25 80 4 -2,
  R -19 29 -1 0,
  R 1 108 3 3,
  B -51 84 -3 -3,
  B -9 150 -1 -1,
  B -51 45 1 -2,
  R -29 135 5 4,
  B 20 119 1 3,
  B -8 117 1 3,
  B -12 71 2 3,
  R -5 67 -2 -2,
  B 10 80 -4 3,
  B 36 79 4 5,
  B -12 136 3 5,
  R 17 28 2 -2,
  B 28 117 5 0,
  B 2 37 2 -2,
  B -5 34 4 -5,
  R -20 16 -4 3,
  R -42 99 -2 0,
  B -29 32 -5 1,
  R 46 128 4 -2,
  B 14 21 3 3,
  B 8 5 -5 1,
  R -43 107 4 -5,
  R 41 130 3 -4,
  B -5 101 5 -5,
  B 47 57 -1 2,
  R 1 129 -3 0,
  R -5 117 -4 -2,
  R 7 54 -5 0,
  R -36 64 1 4,
  B -30 102 3 5,
  R 42 22 5 3,
  B 40 2 3 3,
  R 20 103 -2 -3,
  R -41 38 4 -5,
  R 41 163 -3 -4,
  B -6 103 -5 -1,
  R -51 29 3 3"
4)
    
"5"
Returns: 
"seed = 5
W = 83, H = 124, D = 29, speed=8
178 particles:
  R -73 26 -3 -4,
  R -54 88 2 3,
  B 22 77 4 0,
  R 79 29 4 3,
  B -1 69 3 5,
  R 7 1 -5 1,
  B -2 81 -3 1,
  B 59 90 -1 -1,
  B -57 44 4 -1,
  B -78 76 3 -1,
  B -11 81 5 -5,
  B -56 17 5 -1,
  B -28 43 -4 -3,
  R -82 35 2 3,
  B -21 60 -2 0,
  R -41 86 -1 0,
  R 54 77 4 4,
  R -58 29 4 2,
  R -41 67 -1 0,
  R 37 99 5 -2,
  R -54 114 3 0,
  B 50 42 3 0,
  R 73 57 4 1,
  R 73 64 2 -2,
  R 51 64 2 -2,
  B -52 14 5 -2,
  R 10 79 4 0,
  B -81 25 -4 -3,
  B 8 102 2 5,
  R -68 62 -1 2,
  R 61 104 5 1,
  R 8 66 1 0,
  R -81 121 2 2,
  B 54 32 -5 -2,
  B -15 110 5 0,
  R 73 57 -1 3,
  R 6 12 3 3,
  B -14 30 1 -5,
  R 51 14 5 -5,
  B 81 80 -3 4,
  B 47 115 2 -4,
  B 11 18 -2 2,
  R 36 113 4 -3,
  R 63 7 2 2,
  B -8 81 -4 -2,
  B 79 29 -5 -3,
  R -49 5 -5 -3,
  B 18 56 4 5,
  B 67 25 5 -3,
  B -14 96 4 -5,
  R -25 44 1 4,
  B -70 94 -1 -5,
  B 37 83 -4 3,
  B 42 4 2 -2,
  B 26 51 -2 -4,
  R -79 74 -2 -2,
  R -47 59 -1 5,
  B 47 45 -5 -4,
  B 74 71 5 -2,
  B 80 2 1 -4,
  B 26 61 4 4,
  B 72 84 3 -4,
  R 26 94 5 -3,
  B 39 120 -2 -3,
  R -64 82 3 1,
  B -33 74 2 -2,
  B -3 73 -3 -5,
  B 65 116 4 -4,
  R 30 2 1 3,
  B 80 65 -5 -5,
  R 61 100 -4 -1,
  B 82 58 -4 -2,
  B 37 7 -5 -5,
  R -16 72 -4 -4,
  B -31 97 1 -4,
  R 22 41 -4 2,
  B 32 54 -5 -2,
  B -45 5 4 -1,
  B -53 77 4 -2,
  B 26 53 -2 5,
  R 38 56 -2 4,
  R -42 12 -3 -2,
  R 3 115 3 -2,
  B -6 42 -5 -4,
  R 62 19 1 -4,
  B 67 118 -1 -2,
  B -75 31 -5 -1,
  R -17 11 1 -1,
  B -59 18 5 2,
  R 41 87 -3 3,
  R 6 13 2 0,
  R -31 82 1 -2,
  R 16 88 2 -1,
  R 1 115 1 -1,
  B -29 56 -1 2,
  R 74 34 4 1,
  R -5 57 3 2,
  R -72 48 -2 -3,
  B 75 15 4 3,
  B -33 113 -2 -2,
  B -28 20 1 -2,
  B -54 44 -1 2,
  R -9 60 -5 0,
  R 81 69 3 -2,
  B 55 6 -1 5,
  R 9 35 -3 -3,
  R -56 53 4 -4,
  R -61 13 -4 4,
  R 65 101 -5 -3,
  B 50 87 -1 4,
  R -41 98 -3 0,
  R -51 90 4 0,
  R -8 31 5 0,
  B 13 9 -3 -2,
  R 48 105 -2 1,
  R 63 33 4 2,
  R 63 34 -3 -1,
  B -3 69 3 4,
  R 59 106 -3 3,
  R -25 120 5 1,
  B 63 60 -4 5,
  B -26 67 1 0,
  R 61 97 -1 -4,
  B -53 109 5 -1,
  R -11 75 -4 5,
  R 34 9 4 0,
  B -8 16 -2 -5,
  B 56 65 -5 1,
  R 38 55 -1 -3,
  B 26 88 -5 -1,
  B 41 52 1 5,
  B -35 42 2 1,
  R 49 21 -5 -5,
  R 14 26 -5 0,
  R 60 34 2 4,
  R 56 123 1 2,
  B 46 84 -2 4,
  R -67 107 5 -1,
  R 32 46 3 -3,
  B -69 88 1 -1,
  B 38 110 -1 -4,
  R -12 81 5 4,
  R -64 2 4 0,
  R -23 115 2 4,
  R 22 12 3 1,
  B 16 10 -2 -2,
  R 24 12 5 -2,
  R -21 30 2 3,
  B 7 75 -4 -4,
  B -67 51 -5 5,
  B -43 122 2 3,
  B -46 90 5 4,
  R -29 20 3 3,
  B 40 14 -4 -4,
  B -2 31 3 2,
  R 46 54 -2 -2,
  B -79 33 -1 -5,
  B 47 56 4 5,
  R 33 93 4 -4,
  R 26 52 -3 1,
  B -7 38 5 2,
  B -14 109 -1 -1,
  R 65 118 3 5,
  B -63 19 4 3,
  R 19 50 -3 -5,
  R -1 20 -1 -4,
  R -28 55 -3 3,
  B -52 23 -4 4,
  R 12 90 -2 -2,
  B 74 4 -3 4,
  B -48 3 -2 0,
  R 9 46 2 -5,
  B -31 112 4 -1,
  R 81 104 -5 2,
  R 81 59 2 -3,
  B -40 90 5 3,
  R 79 3 -2 4,
  B -56 93 2 -1"
5)
    
"6"
Returns: 
"seed = 6
W = 34, H = 45, D = 11, speed=6
89 particles:
  R 19 35 -3 -5,
  B 4 10 -3 3,
  B -22 2 4 -1,
  B 15 19 3 5,
  B 20 25 -1 3,
  R 3 38 1 2,
  R 9 6 -5 -3,
  R 7 39 1 3,
  R -26 12 -5 -3,
  R -4 7 1 -3,
  B -11 38 -3 5,
  R -12 44 -2 -5,
  B 3 38 -4 4,
  B -4 26 4 -3,
  R -17 23 1 3,
  R 22 16 2 0,
  R -20 40 -5 -3,
  R -1 3 -1 -2,
  B 29 7 -3 3,
  B -19 39 -3 -5,
  R -7 15 1 2,
  R 3 37 -1 -5,
  R -4 35 5 -4,
  B -7 28 -2 5,
  B -21 29 3 -1,
  B -32 12 -2 5,
  R -24 38 2 2,
  B 31 40 -5 -3,
  B 16 5 -4 -3,
  R -19 15 -3 -1,
  B 33 18 -4 1,
  B -15 18 4 3,
  R 9 41 -5 0,
  R 2 18 1 2,
  R -29 43 4 4,
  B 15 7 4 -3,
  B -2 23 5 0,
  B 25 5 -2 -5,
  R -9 41 -2 -4,
  B 1 31 -2 5,
  B 2 38 -2 5,
  B -29 12 -4 0,
  R -2 39 5 1,
  R 32 2 5 0,
  B 18 8 -3 4,
  B -4 23 1 -2,
  R -26 21 4 -2,
  R -20 14 4 -5,
  R -19 17 -5 -2,
  B 24 36 -1 5,
  B 15 32 3 4,
  R 9 7 3 5,
  B -9 9 -5 -2,
  R 8 20 3 5,
  B -3 2 -3 3,
  R 12 39 2 2,
  B 13 18 5 5,
  B -13 32 -4 -3,
  B -33 32 -4 2,
  B 11 22 1 -1,
  B 27 12 5 3,
  R -33 24 -2 -2,
  R -9 38 2 -5,
  B -6 5 1 -5,
  B 29 13 -2 1,
  R 17 32 -5 3,
  B 23 4 -4 4,
  B 30 26 2 0,
  B 6 32 1 1,
  B 31 5 -1 -5,
  B -14 23 -2 5,
  B -27 13 -3 -5,
  B 18 18 5 -4,
  R -30 24 -4 3,
  B 23 23 -3 -1,
  B -30 37 2 0,
  R -2 8 5 -3,
  R -33 20 3 -3,
  B 8 22 2 -5,
  R -21 10 -3 -2,
  R 20 21 2 0,
  B -6 17 -2 -4,
  B 22 5 -3 2,
  B 20 26 -2 -4,
  B 21 42 -4 -5,
  R 20 38 -1 1,
  R 2 14 -5 -1,
  B -15 24 -5 3,
  R -14 33 5 5"
6)
    
"7"
Returns: 
"seed = 7
W = 98, H = 77, D = 11, speed=7
61 particles:
  R 25 61 2 -3,
  B 92 26 1 1,
  B 47 40 1 5,
  B -94 52 4 1,
  B -43 76 -1 -1,
  B -63 31 -3 2,
  B -42 62 -3 5,
  B 25 63 5 0,
  R -69 73 -2 -2,
  R 34 65 -1 3,
  R 40 37 -1 5,
  B -77 62 -1 4,
  R 55 19 5 -5,
  R 65 32 3 -4,
  B -17 8 -3 4,
  B -58 46 5 -5,
  R 93 15 -2 -5,
  B 76 26 -5 -3,
  R 65 57 -1 5,
  B -56 64 5 3,
  B -93 3 1 -4,
  B 92 61 -3 2,
  R -79 45 3 -3,
  R -38 56 -3 2,
  R -44 33 -3 5,
  R 69 8 -1 2,
  B 19 70 -2 5,
  R 72 69 -5 -1,
  R 5 54 -4 5,
  B 57 35 3 4,
  B -70 45 -2 -1,
  B -28 26 5 -3,
  B 28 56 -4 -4,
  B -2 6 -5 0,
  R 59 32 -4 -1,
  R 50 41 1 0,
  B -42 50 -2 4,
  B -27 74 2 -4,
  R -93 11 -4 -4,
  B -70 15 -2 -4,
  R 96 37 -1 -1,
  B -57 15 1 2,
  B 50 67 -4 4,
  R 57 35 -1 -2,
  R 59 58 -5 -2,
  R 39 29 -5 0,
  B -14 59 -3 -1,
  R -1 16 4 2,
  R -19 21 3 3,
  R -86 11 -4 0,
  B 30 24 1 -3,
  R -37 62 4 4,
  B 58 23 -5 4,
  R -85 73 5 -4,
  B 83 45 -5 1,
  B 15 29 -3 2,
  B 79 13 3 -1,
  R 26 34 -1 3,
  B 81 50 -4 4,
  R -69 63 -3 -3,
  R 28 31 -5 -4"
7)
    
"8"
Returns: 
"seed = 8
W = 49, H = 137, D = 17, speed=9
124 particles:
  B -17 27 4 3,
  B -38 23 -3 -2,
  B -19 77 5 5,
  B 33 111 -4 -3,
  R -29 8 1 1,
  R -15 31 4 -4,
  R -4 62 4 4,
  B 23 49 -1 0,
  B 27 133 -1 5,
  B 14 133 -2 -5,
  R -46 136 -4 1,
  R -14 116 -1 -4,
  B 36 52 2 -4,
  R -31 78 5 4,
  R 46 91 5 -3,
  R 37 40 3 0,
  B 21 21 4 0,
  R 40 8 -1 5,
  R -38 101 2 0,
  B -20 20 4 2,
  R -42 71 -1 5,
  R -20 131 3 0,
  R -24 68 -1 3,
  R -34 46 1 4,
  R -37 21 -4 2,
  R 42 11 -5 3,
  B -32 16 -3 2,
  R -43 111 -5 5,
  R -23 109 1 5,
  R 10 23 -4 -5,
  R 3 46 -5 5,
  R 13 70 4 1,
  R -33 85 1 4,
  R -33 116 -3 -5,
  B 40 77 -4 3,
  R -16 80 -3 -1,
  B -41 87 1 3,
  R 28 133 1 -4,
  B -9 56 5 3,
  R -22 39 -5 5,
  R -23 105 1 5,
  R -11 24 -5 -1,
  R -36 86 5 3,
  B 27 30 -1 5,
  B -36 126 -2 5,
  B 3 128 -5 1,
  B -7 32 -1 2,
  R 17 34 1 -2,
  R -31 27 -4 -1,
  R -17 89 1 -3,
  B 41 91 5 -2,
  R 24 13 3 -3,
  R -24 134 -1 3,
  R 25 8 -5 5,
  R 34 98 3 3,
  B -10 7 1 5,
  B -12 71 5 3,
  B 37 81 3 -5,
  R 31 61 3 -5,
  B -15 3 5 -1,
  B 18 77 1 -2,
  R 39 79 2 0,
  B -4 73 3 4,
  R 9 36 2 5,
  B 43 88 4 1,
  R -21 19 1 -4,
  B -40 22 4 -3,
  B -18 27 1 -5,
  B -21 22 -1 1,
  B 23 7 -1 -3,
  R -22 114 2 0,
  R -27 52 5 2,
  R 40 52 -1 -1,
  B 34 92 4 2,
  R -37 85 -1 -1,
  R 7 122 -5 4,
  B -40 133 -5 -2,
  R -30 73 -3 1,
  B -31 66 -1 4,
  R -43 33 5 4,
  R 9 134 1 4,
  B 7 42 5 -4,
  B -46 5 -5 3,
  B 37 109 -1 0,
  R -24 3 -4 4,
  R -45 118 -2 1,
  R -1 57 -4 2,
  B 30 134 5 -4,
  B -47 35 -4 -1,
  R 29 54 4 -5,
  B 16 132 -1 3,
  B 12 2 -5 5,
  B 15 115 1 -1,
  B -32 3 2 -1,
  B 46 5 -3 -2,
  B -24 46 3 0,
  R 15 113 2 -5,
  R 5 104 -2 4,
  B -8 50 -1 5,
  R -15 102 4 4,
  R 45 44 3 1,
  R 3 57 4 5,
  R 28 37 1 2,
  R 38 1 -3 0,
  R -17 40 2 -1,
  R -8 74 -5 0,
  R 4 26 4 -1,
  R 11 39 -1 1,
  R 21 45 -1 -4,
  R 33 47 3 2,
  R 26 78 5 4,
  R 27 48 1 4,
  R 46 74 2 1,
  B 11 1 4 3,
  B -14 78 5 -4,
  B -8 90 -3 -1,
  R 36 133 3 5,
  R 23 70 -5 2,
  B 15 52 -5 -4,
  R 15 68 -3 -5,
  B 35 28 -2 2,
  B -22 106 -4 3,
  R 44 126 3 3,
  B -17 122 -4 -5"
8)
    
"9"
Returns: 
"seed = 9
W = 55, H = 69, D = 16, speed=3
173 particles:
  R -18 48 2 0,
  R -48 66 -2 1,
  R 26 67 2 1,
  R -18 11 -4 3,
  B -54 28 3 -5,
  B 7 58 1 -5,
  R 1 33 1 -5,
  R 7 32 2 -4,
  B -35 23 2 -3,
  B -54 15 5 -5,
  B 40 61 -2 -4,
  B -32 60 -4 3,
  B 20 18 1 4,
  B 40 23 -4 -2,
  R 50 65 -2 -5,
  B -10 18 -2 5,
  B -43 62 -1 -1,
  B -22 19 -2 -4,
  R -40 28 3 0,
  B 48 32 2 -2,
  R 18 10 -5 2,
  B -40 4 2 -5,
  B 45 67 2 0,
  R 46 30 -4 2,
  R 19 26 3 2,
  R -36 5 -2 3,
  B -29 5 3 0,
  B 19 20 4 0,
  R 45 33 1 1,
  R -49 66 -5 -4,
  R 12 54 1 0,
  R 36 56 -5 -1,
  R -51 53 3 5,
  R -25 61 2 2,
  B -46 65 -4 -4,
  R 44 25 2 -1,
  R 31 33 -3 -2,
  B -8 35 4 4,
  R 20 35 -4 4,
  B 21 44 5 2,
  R 34 30 -2 0,
  B -34 37 -2 3,
  R 34 32 -2 2,
  R -31 55 -3 -3,
  B -15 41 3 -3,
  B -15 2 -2 -3,
  R -42 2 -5 -4,
  R -36 26 1 5,
  R -42 68 2 -2,
  B 49 5 -4 5,
  B -25 57 -5 -5,
  B -2 53 3 -5,
  R 6 59 -1 2,
  B -43 39 -2 0,
  R 9 33 3 2,
  R 2 13 -2 -1,
  B -32 31 -2 -3,
  B -52 45 -2 1,
  R 43 13 3 5,
  R 27 39 5 -5,
  R -41 52 -4 -4,
  B 39 12 -2 -4,
  B 37 24 -3 5,
  R 54 32 3 -4,
  B 15 57 -1 5,
  B -23 37 -5 0,
  R -24 23 3 1,
  R -11 3 2 -3,
  B -48 61 -1 -1,
  R -4 61 4 4,
  R -48 38 -2 4,
  B -4 10 5 -5,
  R -27 32 -4 -5,
  R -48 50 -5 5,
  B -33 44 3 -2,
  R 9 43 1 -4,
  R -45 1 -3 1,
  R 28 10 5 -4,
  R -23 6 -5 3,
  B 46 12 -2 1,
  R -51 20 1 0,
  B -20 44 -2 4,
  B -15 49 5 -3,
  R -19 42 -5 2,
  B 19 41 -2 3,
  B -26 62 2 -2,
  B -44 31 -5 0,
  B -42 11 4 -1,
  R 21 18 2 -5,
  R 6 10 -2 -3,
  R 38 5 3 -4,
  B -29 49 -1 0,
  R -36 12 -5 -3,
  R 41 32 3 -2,
  B 12 44 2 4,
  R -14 55 5 -1,
  B -41 52 4 5,
  B 2 41 3 5,
  R 38 52 2 2,
  R 14 38 5 -4,
  R -45 68 3 1,
  R 33 58 4 3,
  B -18 15 2 -5,
  R 38 44 -3 4,
  R 22 6 1 -2,
  R 12 11 -5 -4,
  B 22 57 4 -3,
  B -24 31 -3 -1,
  R 25 26 -3 0,
  B 32 52 -5 4,
  R 37 25 5 0,
  B 47 22 -5 -2,
  B 41 22 -1 3,
  R -5 46 -2 -5,
  R -24 8 5 2,
  B 39 14 -2 0,
  R 25 34 5 0,
  R -16 26 3 5,
  B -25 61 -3 2,
  B -16 61 -1 5,
  R 3 16 3 -3,
  B -35 47 4 0,
  R -36 24 5 4,
  R 21 8 -5 3,
  B 26 20 -4 -1,
  B 3 48 -5 -1,
  R -3 11 -3 1,
  R -6 18 5 2,
  B 17 26 -2 -3,
  R -37 38 1 -1,
  R 47 50 2 -3,
  R 8 45 -5 -3,
  B -2 46 -2 4,
  R -33 53 1 1,
  B 2 23 -5 -3,
  B -26 45 1 1,
  B -18 29 3 -5,
  B -26 30 -2 3,
  B 7 7 -4 0,
  R -53 10 5 0,
  R -8 52 3 -2,
  R 10 1 -4 0,
  B 18 11 1 0,
  B -16 45 3 -3,
  B 18 12 2 0,
  R 32 1 -5 -5,
  B 53 34 3 -3,
  B -35 60 -1 1,
  B -10 23 3 3,
  B -13 34 -3 4,
  B 41 30 -3 -2,
  R -6 21 3 5,
  B -33 24 2 3,
  B 17 42 1 -2,
  R 39 9 1 -1,
  R -26 12 4 3,
  R 15 46 -4 -2,
  R -48 56 -3 -2,
  R 41 53 1 -2,
  B -14 63 -3 1,
  B -6 39 -1 5,
  R -28 51 -1 2,
  R -15 55 -2 -2,
  R 5 31 -2 -3,
  B -36 14 5 5,
  R -23 44 5 2,
  B 27 52 -2 2,
  B -23 8 -2 4,
  R 22 66 4 0,
  R -31 52 -1 -5,
  B -6 49 1 2,
  B 6 58 1 2,
  R -53 2 -4 4"
9)
    
"10"
Returns: 
"seed = 10
W = 84, H = 71, D = 10, speed=2
133 particles:
  R 70 1 -2 4,
  B 18 57 1 1,
  B 28 53 -4 3,
  B 69 36 3 -3,
  B -55 46 1 0,
  B -5 26 -1 4,
  B 71 65 4 2,
  R -2 53 1 -4,
  R -61 1 1 -5,
  R -34 32 5 4,
  B -52 22 -3 1,
  B -36 2 3 4,
  B 16 41 1 -4,
  R 36 53 -1 -1,
  B 31 57 -2 5,
  B -8 29 1 2,
  B 66 69 2 -4,
  B 82 40 -2 -5,
  R 28 34 2 0,
  R 4 67 -5 5,
  R 55 9 2 -3,
  R 11 39 -2 -2,
  B 23 36 -2 4,
  R 6 56 -1 -3,
  R -66 50 5 1,
  R -24 57 1 1,
  R 70 52 1 -4,
  B 73 57 1 -5,
  R -10 56 4 -2,
  R -51 18 -2 -4,
  R 22 8 3 -5,
  B 5 25 4 -2,
  B 11 36 -1 -2,
  R 50 31 -1 1,
  B 68 14 -5 -1,
  B 43 6 -3 4,
  R 82 51 -5 -5,
  R -31 66 -1 -2,
  R -17 39 -2 2,
  B -18 13 2 2,
  R 37 18 3 -4,
  B -19 46 -1 -2,
  B 49 19 -5 -1,
  R 75 43 -3 1,
  B 7 14 -5 3,
  B -13 53 -2 -5,
  B -10 36 -3 -5,
  B -7 57 5 3,
  B 28 31 4 0,
  B -32 40 3 -1,
  B 25 24 -5 4,
  R 27 63 2 3,
  B 20 41 -5 -3,
  B 19 16 -3 1,
  R 51 5 -4 4,
  R 51 63 3 3,
  B 33 57 -4 2,
  B 30 5 -5 3,
  B 22 36 2 4,
  B -31 4 -3 -2,
  R -53 17 -5 -1,
  R -3 38 1 -1,
  R -82 12 -2 5,
  R 20 28 4 -4,
  R -12 20 2 5,
  R 79 28 4 0,
  R -56 54 -5 -5,
  B -63 63 -3 -5,
  B -78 56 -1 -4,
  B 34 48 -5 1,
  R 73 44 2 -2,
  B -70 63 1 1,
  B -9 46 -5 -1,
  B 30 55 3 -2,
  B 42 22 5 -4,
  R 32 52 5 1,
  B 36 35 5 -3,
  B -27 25 -5 -4,
  R -81 4 2 -2,
  B -49 52 -2 3,
  B -11 1 1 -1,
  R 3 32 -1 5,
  R -31 31 -2 -4,
  R -49 47 2 1,
  B 79 60 -4 0,
  B -11 3 -4 0,
  R 56 34 4 3,
  R -71 20 -1 2,
  B 20 17 1 4,
  R -36 18 4 -4,
  R -71 17 2 -1,
  B 68 45 4 -2,
  B -13 66 4 -1,
  B 5 4 4 -5,
  R -3 45 1 -1,
  B -33 21 -4 5,
  B -46 17 1 0,
  B 21 51 2 5,
  R -44 69 4 -3,
  B 15 66 -5 0,
  R -82 24 3 -4,
  R 39 60 -1 0,
  R 21 7 -1 -4,
  R -54 3 1 -4,
  B 67 55 -2 -4,
  B -1 21 -4 -4,
  B 13 21 -3 -2,
  B 53 11 4 0,
  B 26 32 5 5,
  B 36 14 4 -4,
  B 52 31 -1 1,
  R -49 37 3 -2,
  B -43 52 -4 -3,
  R 21 49 1 -5,
  R 43 36 4 2,
  R 6 38 4 2,
  R 55 63 3 -2,
  R 39 45 -4 -2,
  R 48 31 -3 -2,
  R -81 42 -1 5,
  B -82 21 -5 -3,
  B -61 42 -3 -2,
  R 27 64 -1 -1,
  R 31 29 -3 5,
  B -10 31 -3 4,
  R -41 66 3 5,
  R 18 6 5 2,
  B 54 64 3 -3,
  B -7 64 3 4,
  B -9 58 -3 -1,
  R -47 68 -4 0,
  B 13 68 -3 -1,
  B 62 6 1 -1"

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.