{"problem":{"name":"113. Airplane!","description":{"content":"You're flying an airplane, but you forgot to forgot to refill the fuel tank before you trip. Therefore, you must decide which airport to land at based on a number of factors: proximity, available runw","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10269113"},"statements":[{"statement_type":"Markdown","content":"You're flying an airplane, but you forgot to forgot to refill the fuel tank before you trip. Therefore, you must decide which airport to land at based on a number of factors: proximity, available runway space, and direction. If an airport has no available spaces, you cannot go there. If an airport is too far away, you cannot go there. \n\nYou will receive 3 lines of input, the first being n number of airports, the second being how many miles you can fly, and the third being the direction of the wind (N,S,W,E,NW,NE,SW,SE). Then you will receive n lines of input consisting of 3 variables separated by spaces: the number of available runway spaces, the distance to the airport in miles, and the direction you must fly to get to the airport.\n\nYou will output a number that represents which airport you should fly to.\n\nIf you are flying with the wind direction, the amount of fuel you need to use is halved. If you are flying against the wind direction, it takes two times as much fuel to get to the airport.\n\n## Input\n\nYou will receive 3 lines of input, the first being n number of airports, the second being how many miles you can fly, and the third being the direction of the wind (N,S,W,E,NW,NE,SW,SE). Then you will receive n lines of input consisting of 3 variables separated by spaces: the number of available runway spaces, the distance to the airport in miles, and the direction you must fly to get to the airport.\n\n## Output\n\nYou will output a number that represents which airport you should fly to.\n\n[samples]\n\n## Note\n\nIf you are flying with the wind direction, the amount of fuel you need to use is halved. If you are flying against the wind direction, it takes two times as much fuel to get to the airport.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of airports.  \nLet $ d_{\\text{max}} \\in \\mathbb{R}^+ $ be the maximum distance (in miles) the plane can fly.  \nLet $ w \\in \\{\\text{N}, \\text{S}, \\text{W}, \\text{E}, \\text{NW}, \\text{NE}, \\text{SW}, \\text{SE}\\} $ be the wind direction.  \n\nFor each airport $ i \\in \\{1, \\dots, n\\} $:  \n- Let $ r_i \\in \\mathbb{Z}_{\\geq 0} $ be the number of available runway spaces.  \n- Let $ d_i \\in \\mathbb{R}^+ $ be the distance (in miles) to airport $ i $.  \n- Let $ \\delta_i \\in \\{\\text{N}, \\text{S}, \\text{W}, \\text{E}, \\text{NW}, \\text{NE}, \\text{SW}, \\text{SE}\\} $ be the direction to airport $ i $.  \n\nDefine the fuel multiplier $ m_i $ as:  \n$$\nm_i = \n\\begin{cases}\n0.5 & \\text{if } \\delta_i = w \\\\\n2.0 & \\text{if } \\delta_i \\neq w \\text{ and } \\delta_i \\neq \\text{opposite}(w) \\\\\n1.0 & \\text{otherwise}\n\\end{cases}\n$$  \n*(Note: \"opposite\" means N↔S, E↔W, NW↔SE, NE↔SW)*  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 100 $  \n2. $ d_{\\text{max}} > 0 $  \n3. $ r_i \\geq 0 $, $ d_i > 0 $ for all $ i $  \n4. Airport $ i $ is viable **iff**:  \n   - $ r_i > 0 $  \n   - $ d_i \\cdot m_i \\leq d_{\\text{max}} $  \n\n**Objective**  \nSelect the airport $ i^* \\in \\{1, \\dots, n\\} $ with the **maximum** $ r_i $ among all viable airports.  \nIf multiple airports tie in $ r_i $, select the one with **minimum** $ d_i \\cdot m_i $.  \nIf still tied, select the one with **lowest index** $ i $.  \n\nOutput $ i^* $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10269113","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}