Alcohol
SRM 122 · 2002-12-04 · by chogyonim
Problem Statement
The Stanford Office of Student Affairs has been placing student groups (including the one, the only, the truly incomparable, Leland Stanford Junior University Marching Band) on alcohol probation. However, due to some legal nitpicking, they are only allowed to place a group on alcohol probation if it throws 3 parties in a given year.
Given a
If no group becomes legally eligible for alcohol probation, return "".
Notes
- If no group becomes legally eligible for alcohol probation, return "".
- Element 0 of schedule represents day 0, element 1 represents day 1, and so on. Thus, each day, there is exactly one group that throws a party.
Constraints
- schedule will contain between 0 and 50 elements, inclusive.
- each element of schedule will contain 1 to 10 characters, inclusive.
- each element of schedule will only contain capital letters [A-Z].
{"LSJUMB","SAE","AEP","SAE","LSJUMB","LSJUMB","AEP","LSJUMB"}
Returns: "LSJUMB"
LSJUMB throws 4 parties, while SAE and AEP throw only 2. Therefore LSJUMB is the only group that is legally eligible for alcohol probation.
{"LSJUMB","SAE","SAE","LSJUMB","LSJUMB","SAE","AEP","AEP","AEP"}
Returns: "LSJUMB"
All 3 groups throw 3 parties, so they are all eligible for alcohol probation. The order in which they become eligible is "LSJUMB", "SAE", "AEP".
{"A","B","C","B","A","B","C","B","A","B","D","D","D"}
Returns: "B"
{"KA","SX","TAXI","TAXI","SX","SX","KA","TAXI","KA","KA","TAXI","KA",
"TAXI","ST","KA","KA","KA","KA","KA","SX","SX","SX","SX","SX"}
Returns: "SX"
{"A","B","C","C","A","B","C","A","B","B","C","A","A","B","C","A"}
Returns: "C"
Submissions are judged against all 31 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Alcohol with a public method string punish(vector<string> schedule) · 31 test cases · 2 s / 256 MB per case