{"problem":{"name":"H. Voyager","description":{"content":"Armed with a small canoe and a mental map of the stars, Kiana embarks upon a voyage to a distant island from her own, where she suspects she may find valuable resources that can be brought back to her","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10275H"},"statements":[{"statement_type":"Markdown","content":"Armed with a small canoe and a mental map of the stars, Kiana embarks upon a voyage to a distant island from her own, where she suspects she may find valuable resources that can be brought back to her village community. Unfortunately, the seas can be unforgiving, and Kiana knows that her feeble canoe may not be sturdy enough to survive the extent of the voyage. However, Kiana's island lies within the Polynesian Triangle, and there are hundreds of other islands nearby, $N$ to be precise, where Kiana should be able to find more boat-building wood and construct a hardier vessel. Each island, located at $(x_i, y_i)$ miles in the Pacific Ocean, contains $s_i$ \"units\" of boat-building supplies, whereby each supply unit allows Kiana to upgrade her boat to be capable of traveling 1 additional mile of distance at one time without sinking.\n\nFor example, Kiana starts at the $0^(t h)$ island with $s_0$ supplies that she has already used to build her canoe, and until she upgrades her boat, she can travel a maximum of $s_0$ continuous miles in any direction before her canoe fails. If the distance between say the $0^(t h)$ and $1^(s t)$ island is less than $s_0$, then Kiana could sail to the $1^(s t)$ island and upgrade her boat with $s_1$ supply units, so that going forward she could sail to any island within $s_0 + s_1$ of her current position.\n\nGiven the locations of the Polynesian islands and the amount of wood supplies at each island, determine whether or not Kiana can make it to her destination.\n\nThe first line of input contains the integer $N$ ($2 <= N < 10^3$), denoting the number of neighboring islands known to Kiana. The next $N$ lines each contain three integers, $x_i$, $y_i$, and $s_i$ ($0 <= x_i, y_i, s_i < 10^6$), where $(x_i, y_i)$ is the location of the $i^(t h)$ Polynesian island and $s_i$ is the number of wood supply units available at the island for Kiana to harvest for canoe improvements. The $0^(t h)$ island, described in the first line of input, is Kiana's starting location, and the last line of input, for the $N -1^(t h)$ island, describes Kiana's target destination.\n\nOutput \"YES\" if it is possible for Kiana to reach her destination and \"NO\" otherwise.\n\n## Input\n\nThe first line of input contains the integer $N$ ($2 <= N < 10^3$), denoting the number of neighboring islands known to Kiana. The next $N$ lines each contain three integers, $x_i$, $y_i$, and $s_i$ ($0 <= x_i, y_i, s_i < 10^6$), where $(x_i, y_i)$ is the location of the $i^(t h)$ Polynesian island and $s_i$ is the number of wood supply units available at the island for Kiana to harvest for canoe improvements. The $0^(t h)$ island, described in the first line of input, is Kiana's starting location, and the last line of input, for the $N -1^(t h)$ island, describes Kiana's target destination.\n\n## Output\n\nOutput \"YES\" if it is possible for Kiana to reach her destination and \"NO\" otherwise.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z} $, $ 2 \\leq N < 10^3 $, be the number of islands.  \nFor each island $ i \\in \\{0, 1, \\dots, N-1\\} $:  \n- $ (x_i, y_i) \\in \\mathbb{R}^2 $ is its Euclidean coordinate.  \n- $ s_i \\in \\mathbb{Z}_{\\geq 0} $ is the supply units available at island $ i $.  \n\nKiana starts at island $ 0 $ with initial travel range $ r_0 = s_0 $.  \nHer destination is island $ N-1 $.  \n\n**Constraints**  \n1. $ 0 \\leq x_i, y_i, s_i < 10^6 $ for all $ i $.  \n2. Kiana may travel from island $ i $ to island $ j $ if and only if the Euclidean distance $ d_{ij} = \\sqrt{(x_i - x_j)^2 + (y_i - y_j)^2} \\leq r $, where $ r $ is her current total range.  \n3. Upon reaching island $ j $, her range updates to $ r \\leftarrow r + s_j $.  \n4. Kiana may visit islands in any order, but each island can be visited at most once.  \n\n**Objective**  \nDetermine whether there exists a path from island $ 0 $ to island $ N-1 $, possibly via intermediate islands, such that at each step the travel distance is within the current range, and the range is updated by collecting supplies upon arrival.  \n\nOutput \"YES\" if such a path exists; \"NO\" otherwise.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10275H","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}