ReportAccess
SRM 241 · 2005-05-04 · by erinn
Problem Statement
You are working on a large database that holds information about several different aspects of your company, such as customers, partners, prospects, employees, products, etc. Every user in the system has access to one or more types of data. For instance, a human resources worker might only have access to employee records, while a sales person might have access to prospects, customers, and products.
You are in charge of writing reports that summarize large volumes of this information. However, since the reports may contain more than one type of data, you need to be determine which users should be allowed to view that report. In this case, assume that a user has permission to view a report if and only if they have permission to view all of the types of data contained in that report.
You are given a list of usernames in
You are to return a
Constraints
- userNames will have between 1 and 50 elements, inclusive.
- Each element of userNames will contain between 1 and 50 'a'-'z' characters, inclusive.
- allowedData will contain the same number of elements as userNames.
- Each element of allowedData will contain between 1 and 50 characters, inclusive.
- Each element of allowedData will contain the characters 'a'-'z' or ' '.
- reportData will contain between 1 and 5 elements, inclusive.
- Each element of reportData will contain between 1 and 50 'a'-'z' characters, inclusive.
{"joe", "nick", "ted"}
{"clients products", "products orders", "clients orders"}
{"clients", "products"}
Returns: {"joe" }
Here, only joe has access to both required data types.
{"kathy", "john", "dan", "steve", "cheryl", "tony"}
{"users data", "data orders", "users permissions", "system users controls", "default", "admin users"}
{"users"}
Returns: {"dan", "kathy", "steve", "tony" }
Here, we only need one type of permission to view the report.
{"jim", "scott", "barbara"}
{"users order products", "products shipping", "tracking products orders"}
{"admin"}
Returns: { }
Everyone has a variety of permissions, but nobody has the proper permission.
{"btnttzlloigwxp","zznvaxxqaargkehha","vrgakq","iizdylyutdcafgdspwik"}
{"nciizwywlrhvuc zwfqsmcybwfdequ hwggkhrzhrvststeaao","domegizmfvn pbhaivegfrpfteao ynnqshlskpjrmqtb ognn","dkxcnprbu jwplkwnwsecavpulmhde bzssca idbr","esu"}
{"khhbivaafluhaci","wtism"}
Returns: { }
{"jtltfmvkecneuudds","itlnbqvhcubcrenvh","nqxadrbzgvlntc","rlyewlnzzijipb"}
{"fzmwl zjvxy w ynmgy dwwug kdjtt xhbt bdqdd","sqknfxnsl dai zjvxy bls plhuo w ynmgy dwwug kdjtt","dai dai zjvxy bls plhuo kdjtt xhbt","nf dai zjvxy bls plhuo w ynmgy dwwug kdjtt bdqdd"}
{"bls","dwwug"}
Returns: {"itlnbqvhcubcrenvh", "rlyewlnzzijipb" }
Submissions are judged against all 49 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class ReportAccess with a public method vector<string> whoCanSee(vector<string> userNames, vector<string> allowedData, vector<string> reportData) · 49 test cases · 2 s / 256 MB per case