TrainingCamp
SRM 513 · 2011-05-25 · by gojira_tc
Problem Statement
Now Manao is going to arrange a contest comprised of K problems. Some problems are ad hoc and require no special knowledge, some need a specific topic which was analyzed at the camp and some combine several topics from the camp. This information is given in
Manao wants an estimate on which students should solve which of the problems. He reckons that a student should solve a problem if he attended on each of the days when the topics needed for the problem were analyzed. Return a
Constraints
- attendance will contain between 1 and 50 elements, inclusive.
- Each element of attendance will contain between 1 and 50 characters, inclusive.
- All elements of attendance will be of the same length.
- Each character in attendance will be either '-' or 'X'.
- problemTopics will contain between 1 and 50 elements, inclusive.
- Each element of problemTopics will contain the same number of characters as attendance[0].
- Each character in problemTopics will be either '-' or 'X'.
{"XXX",
"XXX",
"XX-"}
{"---",
"XXX",
"-XX",
"XX-"}
Returns: {"XXXX", "XXXX", "X--X" }
The camp lasted for three days and had three attendees. The first two of them have listened to all the lectures and the third one missed the camp's last day. Of the four problems Manao is going to set for the contest, problem 0 requires no special knowledge, problem 1 combines all three topics taught at the camp and the other two problems are a blend of two of those techniques. Students 0 and 1 should be able to solve all problems, while student 2 is estimated to fail problems 1 and 2 because they both need the topic considered on the last day of the camp.
{"-XXXX",
"----X",
"XXX--",
"X-X-X"}
{"X---X",
"-X---",
"XXX--",
"--X--"}
Returns: {"-X-X", "----", "-XXX", "X--X" }
The camp comprised five days and was attended by four students. Student 0 should solve problems 1 and 3, student 1 is expected to solve nothing, student 2 should solve all problems but the first one and student 3 should solve problems 0 and 3.
{"-----",
"XXXXX"}
{"XXXXX",
"-----",
"--X-X"}
Returns: {"-X-", "XXX" }
Student 0 attended no lectures, but he should still be able to solve problem 1.
{"-",
"X",
"X",
"-",
"X"}
{"-",
"X"}
Returns: {"X-", "XX", "XX", "X-", "XX" }
{"X----X--X",
"X--X-X---",
"--X-X----",
"XXXX-X-X-",
"XXXX--XXX"}
{"X----X-X-",
"-----X---",
"-X----X-X",
"-X-X-X---",
"-----X---",
"X-------X"}
Returns: {"-X--XX", "-X--X-", "------", "XX-XX-", "--X--X" }
Submissions are judged against all 85 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class TrainingCamp with a public method vector<string> determineSolvers(vector<string> attendance, vector<string> problemTopics) · 85 test cases · 2 s / 256 MB per case