{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"hlce","formal_name":"Humanity's Last Code Exam","introduction":"Humanity's Last Code Exam evaluates problem solving and code generation using ICPC World Finals and IOI problems. The project describes 235 problems; this import selects its public ICPC dataset of 146 problems.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://humanity-s-last-code-exam.github.io/website/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"43470dab-69fe-5119-b22a-cf52723b8aee","task_key":"ICPC~2dWorld~2dFinals--examples--2023~5fG","task_revision_id":"2","upstream_id":"2023_G","short_description":"Turning Red","config":"ICPC-World-Finals","split":"examples","body":"{\"platform\":\"atcoder\",\"question_content\":\"**Problem Description**\\n\\nMei’s parents have spent the last year remodeling their house, but their lighting system is quite complex! Each room in the house has an LED light, which can be set to red, green, or blue. Throughout the house are various buttons which are each connected to one or more lights. When a button is pressed, any red lights connected to that button become green, any green lights connected to that button become blue, and any blue lights connected to that button become red. Each button can be pressed multiple times. Because the house was built prior to the invention of crossbar wiring, each light is controlled by at most two buttons.\\n\\nMei’s favorite color is red, so she wants to turn all of the lights red. Her parents, fearing the buttons will wear out, have asked her to minimize the total number of button presses.\\n\\n**Input**\\n\\n- The first line of input contains two positive integers \\\\( l \\\\) and \\\\( b \\\\), where \\\\( 1 \\\\leq l \\\\leq 2 \\\\times 10^5 \\\\) is the number of lights and \\\\( 0 \\\\leq b \\\\leq 2 \\\\times l \\\\) is the number of buttons.\\n- The second line of input is a string of \\\\( l \\\\) characters, all either R, G, or B, where the \\\\( i \\\\)-th character is the initial color of the \\\\( i \\\\)-th light.\\n- The next \\\\( b \\\\) lines describe the buttons. Each of these lines begins with an integer \\\\( k \\\\) (\\\\( 1 \\\\leq k \\\\leq l \\\\)), the number of lights controlled by this button. Then \\\\( k \\\\) distinct integers follow, the lights controlled by this button. The lights are indexed from 1 to \\\\( l \\\\), inclusive. Each light appears at most twice across all buttons.\\n\\n**Output**\\n\\n- Output the minimum number of button presses Mei needs to turn all the lights red. If it is impossible for Mei to turn all of the lights red, output `impossible`.\\n\\n**Sample Input 1**\\n```\\n8 6\\nGBRBRRRG\\n2 1 4\\n1 2\\n4 4 5 6 7\\n3 5 6 7\\n1 8\\n1 8\\n```\\n\\n**Sample Output 1**\\n```\\n8\\n```\\n\\n**Sample Input 2**\\n```\\n4 3\\nRGBR\\n2 1 2\\n2 2 3\\n2 3 4\\n```\\n\\n**Sample Output 2**\\n```\\nimpossible\\n```\\n\\n**Sample Input 3**\\n```\\n4 4\\nGBRG\\n2 1 2\\n2 2 3\\n2 3 4\\n1 4\\n```\\n\\n**Sample Output 3**\\n```\\n6\\n```\\n\\n**Sample Input 4**\\n```\\n3 3\\nRGB\\n1 1\\n1 2\\n1 3\\n```\\n\\n**Sample Output 4**\\n```\\n3\\n```\",\"question_title\":\"Turning Red\"}","display_format":"text","language":"","answer_status":"published","assets":[],"source_url":"https://humanity-s-last-code-exam.github.io/website/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}