Statistics

Problem Statement for "IronMan"

Problem Statement

PROBLEM STATEMENT

After many months of using a two-division competition structure, TopCoder
decides to revamp contest organization and needs your help to correctly compute
room assignments under a new scheme sometimes referred to as IronMan room
assignments.  Your task is to determine the room assignments for a sample
competition.

For purposes of this problem, each room will have at most eight coders assigned
to it.  The total number of rooms will be the number of coders divided by
eight, rounded up.  If there are not enough coders to fill all the rooms, the
rooms will be filled as evenly as possible, with any smaller numbered rooms
possibly having fewer coders.  Thus, if there are 22 coders, Room 1 will have 7
coders, Room 2 will have 7 coders, and Room 3 will have 8 coders.  Any other
arrangement is not allowed.

Next, to figure out what coders go to each room, first compare their ratings.
The highest rated coders are assigned to Room 1.  The next highest rated coders
are assigned to Room 2.  This process is repeated until all rooms are filled.
However, in the case that ratings are tied, the coder with a higher volatility
is considered higher.  If a tie still remains, assign the coder that comes
first in the String[] before the other tied coder.

Each element of the String[] will be of the form "handle, rating, volatility".
Return an int[] indicating what rooms the coders are assigned to.  Element zero
of the output int[] should be set to the room assignment of the coder in
element zero the input String[], element one of the output int[] should be set
to the room assignement of the coder in element one the input String[], etc.
Thus the output int[] should contain exactly as many elements as the input
String[].  Rooms are numbered beginning with 1 (increasing by one thereafter).

DEFINITION
Class name: IronMan
Method name: makeRooms
Parameters: String[]
Returns: int[]

Here is the method signature (be sure your method is public): int[]
makeRooms(String[] coders)

TopCoder will ensure the validity of the inputs. Inputs are valid if all of the
following criteria are met:

* There are at most 50 elements to the input String[] (of the form "handle,
rating, volatility")
* Each element of the input String[] is at most 50 characters
* Handles may contain letters, numbers, and spaces [a-z, A-Z, 0-9, ' ']
* Handles are unique and not case-sensitive
* Handles are at least one character in length
* There will be exactly one space after each field-separating comma
* Ratings will be in the range 0 to 3500, inclusive, and will not have leading
zeroes
* Volatilities will be in the range 0 to 1000, inclusive, and will not have
leading zeroes

EXAMPLES
["Top Coder, 3000, 1",
 "Good Coder, 2000, 243",
 "Better Coder, 2200, 300",
 "Decent Coder, 1500, 444",
 "Green Coder, 1200, 123",
 "Grey Coder, 500, 712",
 "Bad Coder, 0, 385"]
Because all the coders can fit into a single room (room 1), makeRooms should
return [1, 1, 1, 1, 1, 1, 1].
 
["Top Coder, 3000, 1",
 "Good Coder, 2000, 243",
 "Better Coder, 2200, 300",
 "Decent Coder, 1500, 444",
 "Green Coder, 1200, 123",
 "Grey Coder, 500, 712",
 "Bad Coder, 0, 385",
 "Sharp Coder, 2500, 225",
 "Tame Coder, 1700, 0",
 "Wild Coder, 1700, 1000",
 "Average Coder, 1202, 385",
 "Dream Coder, 3500, 0",
 "YAC, 1234, 567",
 "Last One, 2345, 678"]
Now that there are more coders, they need to be divided among two rooms, so
makeRooms should return [1, 1, 1, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1].

["a, 999, 333",
 "b, 999, 444",
 "c, 999, 222",
 "d, 999, 333",
 "e, 999, 444",
 "f, 999, 333",
 "g, 999, 222",
 "h, 999, 444",
 "i, 999, 333",
 "j, 999, 333",
 "k, 999, 222",
 "l, 999, 333",
 "m, 999, 444",
 "n, 999, 222",
"o, 999, 333"], makeRooms should return [1, 1, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2,
1, 2, 2].

[], makeRooms should return [].

Definition

Class:
IronMan
Method:
makeRooms
Parameters:
String[]
Returns:
int[]
Method signature:
int[] makeRooms(String[] param0)
(be sure your method is public)

Constraints

    Examples


      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)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: