{"problem":{"name":"D. Large Triangle","description":{"content":"> > There is a strange peculiarity: if you connect the cities of Rostov, Taganrog and Shakhty, peculiarly, you get a triangle> — «Unbelievable But True»Students from many different parts of Russia and","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF1019D"},"statements":[{"statement_type":"Markdown","content":"> > There is a strange peculiarity: if you connect the cities of Rostov, Taganrog and Shakhty, peculiarly, you get a triangle> — «Unbelievable But True»Students from many different parts of Russia and abroad come to Summer Informatics School. You marked the hometowns of the SIS participants on a map.\n\nNow you decided to prepare an interesting infographic based on this map. The first thing you chose to do is to find three cities on this map, such that they form a triangle with area $S$.\n\n## Input\n\nThe first line of input contains two integers $n$ and $S$ ($3 \\le n \\le 2000$, $1 \\le S \\le 2 \\cdot 10^{18}$) — the number of cities on the map and the area of the triangle to be found.\n\nThe next $n$ lines contain descriptions of the cities, one per line. Each city is described by its integer coordinates $x_i$, $y_i$ ($-10^9 \\le x_i, y_i \\le 10^9$).\n\nIt is guaranteed that all cities are located at distinct points. It is also guaranteed that no three cities lie on the same line.\n\n## Output\n\nIf the solution doesn't exist — print «_No_».\n\nOtherwise, print «_Yes_», followed by three pairs of coordinates $(x, y)$ — the locations of the three cities, which form the triangle of area $S$.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"来自俄罗斯各地及海外的学生来到夏季信息学学校。你已在地图上标记了SIS参与者的家乡。\n\n现在你打算基于这张地图制作一个有趣的信息图。你首先决定找出地图上的三个城市，使它们构成一个面积为 $S$ 的三角形。\n\n输入的第一行包含两个整数 $n$ 和 $S$（$3 lt.eq n lt.eq 2000$，$1 lt.eq S lt.eq 2 dot.op 10^(18)$）—— 分别表示地图上的城市数量和目标三角形的面积。\n\n接下来的 $n$ 行每行描述一个城市，包含其整数坐标 $x_i$, $y_i$（$-10^9 lt.eq x_i, y_i lt.eq 10^9$）。\n\n保证所有城市位于不同的点，且任意三个城市都不共线。\n\n如果无解，请输出 «_No_»。\n\n否则，输出 «_Yes_»，随后跟三对坐标 $(x, y)$ —— 构成面积为 $S$ 的三角形的三个城市的位置。\n\n## Input\n\n输入的第一行包含两个整数 $n$ 和 $S$（$3 lt.eq n lt.eq 2000$，$1 lt.eq S lt.eq 2 dot.op 10^(18)$）—— 分别表示地图上的城市数量和目标三角形的面积。接下来的 $n$ 行每行描述一个城市，包含其整数坐标 $x_i$, $y_i$（$-10^9 lt.eq x_i, y_i lt.eq 10^9$）。保证所有城市位于不同的点，且任意三个城市都不共线。\n\n## Output\n\n如果无解，请输出 «_No_»。否则，输出 «_Yes_»，随后跟三对坐标 $(x, y)$ —— 构成面积为 $S$ 的三角形的三个城市的位置。\n\n[samples]","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of cities.  \nLet $ S \\in \\mathbb{Z}^+ $ be the target area.  \nLet $ P = \\{ (x_i, y_i) \\mid i \\in \\{1, \\dots, n\\} \\} $ be a set of $ n $ distinct points in $ \\mathbb{R}^2 $, with no three collinear.\n\n**Constraints**  \n1. $ 3 \\leq n \\leq 2000 $  \n2. $ 1 \\leq S \\leq 2 \\cdot 10^{18} $  \n3. $ -10^9 \\leq x_i, y_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $  \n4. All points in $ P $ are distinct.  \n5. No three points in $ P $ are collinear.\n\n**Objective**  \nFind three distinct points $ A = (x_a, y_a), B = (x_b, y_b), C = (x_c, y_c) \\in P $ such that the area of triangle $ \\triangle ABC $ equals $ S $, where the area is given by:  \n$$\n\\text{Area} = \\frac{1}{2} \\left| (x_b - x_a)(y_c - y_a) - (x_c - x_a)(y_b - y_a) \\right|\n$$\n\nIf such a triple exists, output:  \n```\nYes\nx_a y_a\nx_b y_b\nx_c y_c\n```  \nOtherwise, output:  \n```\nNo\n```","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF1019D","tags":["binary search","geometry","sortings"],"sample_group":[["3 7\n0 0\n3 0\n0 4","No"],["4 3\n0 0\n2 0\n1 2\n1 3","Yes\n0 0\n1 3\n2 0"]],"created_at":"2026-03-03 11:00:39"}}