WhichDay
SRM 519 · 2011-05-25 · by misof
Problem Statement
This week there will be an important meeting of your entire department. You clearly remember your boss telling you about it. The only thing you forgot is the day of the week when the meeting will take place.
You asked six of your colleagues about the meeting. None of them knew the day when it will take place, but each of them remembered one day when it will not take place. The days they remembered were distinct. For a clever programmer like you, this was enough to determine the day of the meeting.
You are given a
Notes
- There are seven weekdays. Their names are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday".
Constraints
- notOnThisDay will contain exactly 6 elements.
- Each element of notOnThisDay will be a name of a weekday (in the exact form specified in the Note above).
- No two elements of notOnThisDay will be equal.
{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}
Returns: "Saturday"
{"Sunday", "Monday", "Tuesday", "Wednesday", "Friday", "Thursday"}
Returns: "Saturday"
{"Sunday", "Monday", "Tuesday", "Thursday", "Friday", "Saturday"}
Returns: "Wednesday"
{"Sunday", "Friday", "Tuesday", "Wednesday", "Monday", "Saturday"}
Returns: "Thursday"
{ "Friday" , "Monday" , "Thursday" , "Tuesday" , "Sunday" , "Saturday" }
Returns: "Wednesday"
Submissions are judged against all 78 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class WhichDay with a public method string getDay(vector<string> notOnThisDay) · 78 test cases · 2 s / 256 MB per case