From a283c18081fac0919a5a9531cf5e56c8d148c231 Mon Sep 17 00:00:00 2001 From: Almaz Date: Wed, 13 Aug 2025 11:21:01 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/russian/cs/convex-hulls/jarvis.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/russian/cs/convex-hulls/jarvis.md b/content/russian/cs/convex-hulls/jarvis.md index 333a7311..0f5e34d4 100644 --- a/content/russian/cs/convex-hulls/jarvis.md +++ b/content/russian/cs/convex-hulls/jarvis.md @@ -28,13 +28,14 @@ vector jarvis(vector points) { p0 = p; vector hull = {p0}; while (true) { - r t = p0; // кандидат на следующую точку + r t = points[0]; // кандидат на следующую точку + if (t == p0) t = points[1]; // чтобы не брать начальную точку в кандидаты for (r p : points) // лучше никакие полярные углы не считать if ((p - p0) ^ (t - p0) > 0) t = p; - if (t == p0) - continue; + if (t == p0) // если вернулись к началу — выходим + break; else { p0 = t; hull.push_back(t);