{"id":2011,"date":"2022-08-27T23:42:51","date_gmt":"2022-08-27T15:42:51","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=2011"},"modified":"2022-08-27T23:42:51","modified_gmt":"2022-08-27T15:42:51","slug":"bzoj-1185-hnoi2007%e6%9c%80%e5%b0%8f%e7%9f%a9%e5%bd%a2%e8%a6%86%e7%9b%96","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/bzoj-1185-hnoi2007%e6%9c%80%e5%b0%8f%e7%9f%a9%e5%bd%a2%e8%a6%86%e7%9b%96\/","title":{"rendered":"BZOJ 1185. [HNOI2007]\u6700\u5c0f\u77e9\u5f62\u8986\u76d6"},"content":{"rendered":"<p>\u7ecf\u5178\u9898\u3002\u3002<br \/>\n\u6d4b\u6a21\u677f\u3002\u3002<\/p>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n#include &lt;lastweapon\/geometry&gt;\r\nusing namespace lastweapon;\r\nusing namespace CG;\r\n\r\ntypedef vector&lt;Po&gt; VP;\r\n\/*#define suc(x) (x+1==n?0:x+1)\r\nDB rc(const VP&amp; P){\r\n    int n = SZ(P)-1, j = 1; DB d2 = 0; REP(i, n){\r\n        while (dett(P&#x5B;i+1]-P&#x5B;i], P&#x5B;j+1]-P&#x5B;j])&gt;0) j=suc(j);\r\n        checkMax(d2, max(dist2(P&#x5B;i], P&#x5B;j]), dist2(P&#x5B;i+1], P&#x5B;j+1])));\r\n    }\r\n    return d2;\r\n}*\/\r\n\r\n#define suc(x) (x+1==n?0:x+1)\r\nDB rc(const VP&amp; P){\r\n    VP R;\r\n    int n=SZ(P)-1,l=1,r=1,u=1,ll=1,rr=1,uu=1; DB z=OO; REP(i, n){\r\n\r\n        Line p(P&#x5B;i], P&#x5B;i+1]); p.b = p.a + p.d()._1();\r\n\r\n        while (dott(p.d(), P&#x5B;r+1]-P&#x5B;r])&gt;0) r=suc(r),++rr; if (uu&lt;rr)u=r,uu=rr; \/\/#\r\n        while (dett(p.d(), P&#x5B;u+1]-P&#x5B;u])&gt;0) u=suc(u),++uu; if (ll&lt;uu)l=u,ll=uu;\r\n        while (dott(p.d(), P&#x5B;l+1]-P&#x5B;l])&lt;0) l=suc(l),++ll;\r\n\r\n        DB w = \/\/dist(Line(P&#x5B;r], P&#x5B;r]+p.d().lt()), Line(P&#x5B;l], P&#x5B;l]+p.d().lt())); \/\/?\r\n            dot(p, P&#x5B;r]) - dot(p, P&#x5B;l]);\r\n        DB h = dist(p, P&#x5B;u]);\r\n        \/\/cout &lt;&lt; w &lt;&lt; &quot; &quot; &lt;&lt; h &lt;&lt; endl;\r\n        if (checkMin(z, w*h)) {\r\n            R.clear();\r\n            R.PB(P&#x5B;l]&amp;p); R.PB(P&#x5B;r]&amp;p);\r\n            p = Line(P&#x5B;u], P&#x5B;u] + p.d());\r\n            R.PB(P&#x5B;l]&amp;p); R.PB(P&#x5B;r]&amp;p);\r\n        }\r\n    }\r\n\r\n    printf(&quot;%.5f\\n&quot;, z+EPS);\r\n    R = getCH(R); int o = 0; REP(i, 4) {\r\n        if (sgn(R&#x5B;i].y, R&#x5B;o].y) &lt; 0 || sgn(R&#x5B;i].y, R&#x5B;o].y) == 0 &amp;&amp;sgn(R&#x5B;i].x, R&#x5B;o].x) &lt; 0) o = i;\r\n        R.PB(R&#x5B;i]);\r\n    }\r\n\r\n    REP(i, 4) printf(&quot;%.5f %.5f\\n&quot;, R&#x5B;o+i].x+EPS, R&#x5B;o+i].y+EPS);\r\n}\r\n\r\nVP P; int n;\r\n\r\nint main(){\r\n\r\n#ifndef ONLINE_JUDGE\r\n    freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);\r\n    \/\/freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);\r\n#endif\r\n\r\n    RD(n); P.resize(n); REP(i, n) P&#x5B;i].in();\r\n    rc(getCH(P));\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7ecf\u5178\u9898\u3002\u3002 \u6d4b\u6a21\u677f\u3002\u3002 #include &lt;lastweapon\/geometry&gt; using namespace lastweapon; using namespace CG; typedef vector&lt;Po&gt; VP; \/*#define suc(x) (x+1==n?0:x+1) DB rc(const VP&amp; P){ int n = SZ(P)-1, j = 1; DB d2 = 0; REP(i, n){ while (dett(P&#x5B;i+1]-P&#x5B;i], P&#x5B;j+1]-P&#x5B;j])&gt;0) j=suc(j); checkMax(d2, max(dist2(P&#x5B;i], P&#x5B;j]), dist2(P&#x5B;i+1], P&#x5B;j+1]))); } return d2; }*\/ #define suc(x) (x+1==n?0:x+1) DB rc(const VP&amp; P){ VP R; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[],"class_list":["post-2011","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-wr","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/comments?post=2011"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2011\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=2011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=2011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=2011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}