{"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":"52c801bd-8ef9-50fc-b23f-930d0882b046","task_key":"ICPC~2dWorld~2dFinals--examples--2019~5fA","task_revision_id":"2","upstream_id":"2019_A","short_description":"Azulejos","config":"ICPC-World-Finals","split":"examples","body":"{\"platform\":\"atcoder\",\"question_content\":\"**Problem Description:**\\n\\nCeramic artists Maria and João are opening a small azulejo store in Porto. Azulejos are the beautiful ceramic tiles for which Portugal is famous. Maria and João want to create an attractive window display, but, due to limited space in their shop, they must arrange their tile samples in two rows on a single shelf. Each of João’s tiles has exactly one of Maria’s tiles in front of it and each of Maria’s tiles has exactly one of João’s tiles behind it. These hand-crafted tiles are of many different sizes, and it is important that each tile in the back row is taller than the tile in front of it so that both are visible to passers-by. For the convenience of shoppers, tiles in each row are arranged in non-decreasing order of price from left to right. Tiles of the same price may be arranged in any order subject to the visibility condition stated above.\\n\\nYour task is to find an ordering of the tiles in each row that satisfies these constraints, or determine that no such ordering exists.\\n\\n**Input:**\\n\\nThe first line of input contains an integer \\\\( n \\\\) (\\\\( 1 \\\\leq n \\\\leq 5 \\\\times 10^5 \\\\)), the number of tiles in each row. The next four lines contain \\\\( n \\\\) integers each; the first pair of lines represents the back row of tiles and the second pair of lines represents the front row. Tiles in each row are numbered from 1 to \\\\( n \\\\) according to their ordering in the input. The first line in each pair contains \\\\( n \\\\) integers \\\\( p_1, \\\\ldots, p_n \\\\) (\\\\( 1 \\\\leq p_i \\\\leq 10^9 \\\\) for each \\\\( i \\\\)), where \\\\( p_i \\\\) is the price of tile number \\\\( i \\\\) in that row. The second line in each pair contains \\\\( n \\\\) integers \\\\( h_1, \\\\ldots, h_n \\\\) (\\\\( 1 \\\\leq h_i \\\\leq 10^9 \\\\) for each \\\\( i \\\\)), where \\\\( h_i \\\\) is the height of tile number \\\\( i \\\\) in that row.\\n\\n**Output:**\\n\\nIf there is a valid ordering, output it as two lines of \\\\( n \\\\) integers, each consisting of a permutation of the tile numbers from 1 to \\\\( n \\\\). The first line represents the ordering of the tiles in the back row and the second represents the ordering of the tiles in the front row. If more than one pair of permutations satisfies the constraints, any such pair will be accepted. If no ordering exists, output `impossible`.\\n\\n**Sample Input 1:**\\n\\n```\\n4\\n3 2 1 2\\n2 3 4 3\\n2 1 2 1\\n2 2 1 3\\n```\\n\\n**Sample Output 1:**\\n\\n```\\n3 2 4 1\\n4 2 1 3\\n```\\n\\n**Sample Input 2:**\\n\\n```\\n2\\n1 2\\n2 3\\n2 8\\n2 1\\n```\\n\\n**Sample Output 2:**\\n\\n```\\nimpossible\\n```\",\"question_title\":\"Azulejos\"}","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":[]}