TopCoder problem "Schedule" used in SRM 6 (Division I Level Three , Division II Level Three)



Problem Statement

    
Class Name: Schedule
Method Name: maxClubs
Paramaters: String[]
Returns: int

Ed is an over achieveing, over active college student.  He wants to be in as
many clubs as possible.   Each club has a meeting time, and in order to be in a
club, Ed has to attend the club's meeting, in its entirety.  Each club meets
weekly, one day a week.  Also, being the overachiever he is, Ed has invented a
teleportation system so the time it takes him to get from meeting to meeting is
negligable.  That is, if one club's meeting ends at 10:00 and another club's
meeting starts at 10:00, Ed can be in both clubs.

Implement a class Schedule which contains a method maxClubs.  maxClubs takes a
String[] as a parameter.  The String[] contains the times of clubs' meetings.
The method returns an int that is the maximum number of clubs Ed can be in.

Each element in the String[] represents one club's information and is a String
of the form:
"CLUBNAME d hh:mm LENGTH". (The quotes are for clarity and are not part of the
String).
CLUBNAME is the name of the club and consists of only letters (at least 1 and
at most 20).
d is the day of the meeting.  It is a number from 1 to 7.  1 is Sunday, 2 is
Monday ... 7 is Saturday.
hh:mm is the starting time of the club's meeting, in military time.  It
consists of two numerical digits representing the hour, a colon, and two more
numerical digits representing the minute.  The hour is between 00 and 23,
inclusive.  The minute is between 00 and 59, inclusive.
LENGTH is the length of the meeting in hours.  The length of the meeting is an
integer between 1 and 24, inclusive.

Note:
-There is exactly one space beween CLUBNAME and d, between d and hh:mm, and
between hh:mm and LENGTH.
-Club names are not necessarily unique.
-The solution must run in under 6 seconds on TopCoder's tester.
-If the String[] is empty, Ed can be in 0 clubs.

The method signature is:
public int maxClubs(String[] meetingtimes);

meetingtimes has at most 14 elements.  Each element is a String of the form
given above (TopCoder will check this).

Examples:
If meetingtimes={"MATHTEAM 2 11:00 3","CHESSCLUB 2 12:00 1","FIGURESKATING 2
13:00 2"}, Ed can maximize the number of clubs he is in by being in CHESSCLUB
and FIGURESKATING and the method returns the maximum number of clubs he can be
in: 2.
 

Definition

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

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=80

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=3005&pm=80

Writer:

Unknown

Testers:

Problem categories: