{"id":392,"date":"2017-12-28T16:52:37","date_gmt":"2017-12-28T08:52:37","guid":{"rendered":"http:\/\/kylelv.com\/?p=392"},"modified":"2017-12-28T16:54:52","modified_gmt":"2017-12-28T08:54:52","slug":"bzoj-2618-cqoi2006%e5%87%b8%e5%a4%9a%e8%be%b9%e5%bd%a2-%e5%8d%8a%e5%b9%b3%e9%9d%a2%e4%ba%a4","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=392","title":{"rendered":"bzoj 2618: [Cqoi2006]\u51f8\u591a\u8fb9\u5f62  &#8212; \u534a\u5e73\u9762\u4ea4"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69fdef6d4bddc\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69fdef6d4bddc\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#2618_Cqoi2006%E5%87%B8%E5%A4%9A%E8%BE%B9%E5%BD%A2\" title=\"2618: [Cqoi2006]\u51f8\u591a\u8fb9\u5f62\">2618: [Cqoi2006]\u51f8\u591a\u8fb9\u5f62<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#Description\" title=\"Description\">Description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#Input\" title=\"Input\">Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#Output\" title=\"Output\">Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#Sample_Input\" title=\"Sample Input\">Sample Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#Sample_Output\" title=\"Sample Output\">Sample Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#HINT\" title=\"HINT\">HINT<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blog.kylelv.com\/?p=392\/#Source\" title=\"Source\">Source<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"2618_Cqoi2006%E5%87%B8%E5%A4%9A%E8%BE%B9%E5%BD%A2\"><\/span>2618: [Cqoi2006]\u51f8\u591a\u8fb9\u5f62<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: center;\">Time Limit:\u00a05 Sec\u00a0\u00a0Memory Limit:\u00a0128 MB<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Description\"><\/span>Description<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u9006\u65f6\u9488\u7ed9\u51fa<em>n<\/em>\u4e2a\u51f8\u591a\u8fb9\u5f62\u7684\u9876\u70b9\u5750\u6807\uff0c\u6c42\u5b83\u4eec\u4ea4\u7684\u9762\u79ef\u3002\u4f8b\u5982n=2\u65f6\uff0c\u4e24\u4e2a\u51f8\u591a\u8fb9\u5f62\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-394\" src=\"http:\/\/kylelv.com\/wp-content\/uploads\/2017\/12\/17.jpg\" alt=\"\" width=\"238\" height=\"266\" \/><\/p>\n<p>\u5219\u76f8\u4ea4\u90e8\u5206\u7684\u9762\u79ef\u4e3a5.233\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Input\"><\/span>Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u7b2c\u4e00\u884c\u6709\u4e00\u4e2a\u6574\u6570<em>n<\/em>\uff0c\u8868\u793a\u51f8\u591a\u8fb9\u5f62\u7684\u4e2a\u6570\uff0c\u4ee5\u4e0b\u4f9d\u6b21\u63cf\u8ff0\u5404\u4e2a\u591a\u8fb9\u5f62\u3002\u7b2ci\u4e2a\u591a\u8fb9\u5f62\u7684\u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u6574\u6570<em>m<sub>i<\/sub><\/em>\uff0c\u8868\u793a\u591a\u8fb9\u5f62\u7684\u8fb9\u6570\uff0c\u4ee5\u4e0b<em>m<sub>i<\/sub><\/em>\u884c\u6bcf\u884c\u4e24\u4e2a\u6574\u6570\uff0c\u9006\u65f6\u9488\u7ed9\u51fa\u5404\u4e2a\u9876\u70b9\u7684\u5750\u6807\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Output\"><\/span>Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u8f93\u51fa\u6587\u4ef6\u4ec5\u5305\u542b\u4e00\u4e2a\u5b9e\u6570\uff0c\u8868\u793a\u76f8\u4ea4\u90e8\u5206\u7684\u9762\u79ef\uff0c\u4fdd\u7559\u4e09\u4f4d\u5c0f\u6570\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Input\"><\/span>Sample Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"font-weight: 400;\">2<br \/>\n6<br \/>\n-2 0<br \/>\n-1 -2<br \/>\n1 -2<br \/>\n2 0<br \/>\n1 2<br \/>\n-1 2<br \/>\n4<br \/>\n0 -3<br \/>\n1 -1<br \/>\n2 2<br \/>\n-1 0<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Output\"><\/span>Sample Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"font-weight: 400;\">5.233<\/p>\n<h2><span class=\"ez-toc-section\" id=\"HINT\"><\/span>HINT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>100%\u7684\u6570\u636e\u6ee1\u8db3\uff1a2&lt;=<em>n<\/em>&lt;=10\uff0c3&lt;=<em>m<sub>i<\/sub><\/em>&lt;=50\uff0c\u6bcf\u7ef4\u5750\u6807\u4e3a[-1000,1000]\u5185\u7684\u6574\u6570<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Source\"><\/span>Source<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5c31\u662f\u66b4\u529b\u7684\u6c42\u534a\u5e73\u9762\u4ea4\u5c31\u597d\u4e86<\/p>\n<p>\u4eba\u5bb6\u8ba9\u4fdd\u7559\u4e09\u4f4d\u5c0f\u6570\u6211puts(&#8220;0.00&#8221;)\u8c03\u4e86\u534a\u5929qwq<\/p>\n<pre class=\"lang:c++ decode:true\">#include&lt;map&gt;\r\n#include&lt;cmath&gt;\r\n#include&lt;queue&gt;\r\n#include&lt;cstdio&gt;\r\n#include&lt;cstring&gt;\r\n#include&lt;iostream&gt;\r\n#include&lt;algorithm&gt;\r\nusing namespace std;\r\n#define inf 1000000007\r\n#define ll long long\r\n#define N 1010\r\n#define db double\r\ninline int rd()\r\n{\r\n\tint x=0,f=1;char ch=getchar();\r\n\twhile(ch&lt;'0'||ch&gt;'9'){if(ch=='-')f=-1;ch=getchar();}\r\n\twhile(ch&gt;='0'&amp;&amp;ch&lt;='9'){x=x*10+ch-'0';ch=getchar();}\r\n\treturn x*f;\r\n}\r\nstruct mp{db x,y;}a[N],g[N];\r\nmp operator +(mp a,mp b){return (mp){a.x+b.x,a.y+b.y};}\r\nmp operator -(mp a,mp b){return (mp){a.x-b.x,a.y-b.y};}\r\ndb operator *(mp a,mp b){return a.x*b.y-a.y*b.x;}\r\nmp operator *(db a,mp b){return (mp){b.x*a,b.y*a};}\r\nstruct xx{mp x,y;db af;}c[N],f[N];\r\nbool operator &lt;(xx a,xx b){return a.af==b.af?a.y*(b.x-a.x)&lt;0:a.af&lt;b.af;}\r\nint n,m,tot;\r\nbool fl=0;\r\nmp Q(xx a,xx b)\r\n{\r\n\tdb t=a.y*b.y;\r\n\tif(!t) fl=1;\r\n\treturn (b.y*(a.x-b.x))\/t*a.y+a.x;\r\n}\r\nint main()\r\n{\r\n\tn=rd();\r\n\tfor(int i=1;i&lt;=n;i++)\r\n\t{\r\n\t\tm=rd();\r\n\t\tfor(int j=1;j&lt;=m;j++) a[j].x=rd(),a[j].y=rd();\r\n\t\ta[m+1]=a[1];\r\n\t\tfor(int j=1;j&lt;=m;j++) c[++tot]=(xx){a[j],a[j+1]-a[j],atan2(a[j+1].y-a[j].y,a[j+1].x-a[j].x)};\r\n\t}\r\n\tsort(c+1,c+tot+1);\r\n\tint l=1,r=0;\r\n\tfor(int i=1;i&lt;=tot;i++)\r\n\t{\r\n\t\tif(i==1||c[i].af&gt;c[i-1].af)\r\n\t\t{\r\n\t\t\txx x=c[i];\r\n\t\t\twhile(l&lt;r&amp;&amp;x.y*(g[r]-x.x)&lt;=0) r--;\r\n\t\t\twhile(l&lt;r&amp;&amp;x.y*(g[l+1]-x.x)&lt;=0) l++;\r\n\t\t\tf[++r]=x;\r\n\t\t\tif(l&lt;r) g[r]=Q(f[r-1],x);\r\n\t\t\tif(fl){puts(\"0.000\");return 0;}\r\n\t\t}\r\n\t}\r\n\twhile(l&lt;r&amp;&amp;f[l].y*(g[r]-f[l].x)&lt;=0) r--;\r\n\twhile(l&lt;r&amp;&amp;f[r].y*(g[l+1]-f[r].x)&lt;=0) l++;\r\n\tg[l]=g[r+1]=Q(f[l],f[r]);\r\n\tif(fl){puts(\"0.000\");return 0;}\r\n\tdb ans=0;\r\n\tfor(int i=l;i&lt;=r;i++) ans+=g[i]*g[i+1];\r\n\tprintf(\"%.3lf\\n\",fabs(ans)\/2);\r\n\treturn 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2618: [Cqoi2006]\u51f8\u591a\u8fb9\u5f62 Time Limit:\u00a05 Sec\u00a0\u00a0Memory Limit:\u00a01 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[31],"class_list":["post-392","post","type-post","status-publish","format-standard","hentry","category-bzoj","tag-31"],"_links":{"self":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=392"}],"version-history":[{"count":2,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":395,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions\/395"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}