{"problem":{"name":"[ICPC 2022 Xi'an R] Hotel","description":{"content":"You are doing volunteer work for a programming competition in an ancient hotel. Unfortunately, the hotel provides no phone signal or tap water since it can be dated back to the Qin Dynasty, and you ha","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P3"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9363"},"statements":[{"statement_type":"Markdown","content":"You are doing volunteer work for a programming competition in an ancient hotel. Unfortunately, the hotel provides no phone signal or tap water since it can be dated back to the Qin Dynasty, and you have to assign the contestants to the hotel rooms manually instead of using the internet apps. Fortunately, the hotel has sufficient rooms, and you have taken a computer that lets you do some computation locally.\n\nThere are $n$ teams, each with exactly $3$ contestants. There are $2$ types of rooms in the hotel, the single room and double room, which can receive at most $1$ and $2$ contestants, respectively. To avoid embarrassing contestants, if two contestants are assigned to a double room, they must come from the same team and have the same gender.\n\nThe cost of each room of the same type is the same, but different types may have different costs. Your program needs to calculate the minimum price the host has to pay. The teams are waiting in the registration hall now, and the competition finance officer relies on you to save costs and make a fortune by the residual value. Be quick, or the finance officer will sue you for violating his reputation!\n\n## Input\n\nThe first line of input contains three integers $n$, $c_1$ and $c_2$ ($1 \\leq n, c_1, c_2 \\leq 1\\,000$), denoting the number of teams, the cost of a single room and a double room respectively.\n\nIn the following $n$ lines, each line contains a string $S$ with exactly $3$ uppercase English letters. The letters in a string denote the genders of the contestants in one team and will be represented by $\\texttt{A}$ to $\\texttt{Z}$, respecting the diversity of human beings.\n\n## Output\n\nThe output should contain a single integer, denoting the minimum cost of hotel allocation for contestants.\n\n[samples]\n\n## Note\n\n**Source**: The 2022 ICPC Asia Xi'an Regional Contest Problem F.\n\n**Author**: fstqwq.","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9363","tags":["2022","O2优化","ICPC","西安"],"sample_group":[["3 1 3\nMMM\nMMM\nFFF\n","9\n"],["3 3 1\nABC\nDEF\nGHI\n","9\n"],["10 438 438\nWWW\nSOU\nPUN\nETC\nOME\nCFI\nNAL\nGOO\nDHO\nTEL\n","12264\n"]],"created_at":"2026-03-03 11:09:25"}}