{"id":309,"date":"2016-11-28T19:09:35","date_gmt":"2016-11-28T11:09:35","guid":{"rendered":"http:\/\/kylelv.com\/?p=309"},"modified":"2017-12-22T19:54:06","modified_gmt":"2017-12-22T11:54:06","slug":"bzoj-4300-%e7%bb%9d%e4%b8%96%e5%a5%bd%e9%a2%98","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=309","title":{"rendered":"bzoj 4300: \u7edd\u4e16\u597d\u9898"},"content":{"rendered":"<p><center><\/p>\n<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-69fdef6034038\" 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-69fdef6034038\"  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=309\/#4300_%E7%BB%9D%E4%B8%96%E5%A5%BD%E9%A2%98\" title=\"4300: \u7edd\u4e16\u597d\u9898\">4300: \u7edd\u4e16\u597d\u9898<\/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=309\/#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=309\/#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=309\/#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=309\/#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=309\/#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=309\/#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=309\/#Source\" title=\"Source\">Source<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"4300_%E7%BB%9D%E4%B8%96%E5%A5%BD%E9%A2%98\"><\/span>4300: \u7edd\u4e16\u597d\u9898<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span class=\"green\">Time Limit:\u00a01 Sec\u00a0\u00a0Memory Limit:\u00a0128 MB<\/span><\/center><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Description\"><\/span>Description<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<div>\u7ed9\u5b9a\u4e00\u4e2a\u957f\u5ea6\u4e3an\u7684\u6570\u5217ai\uff0c\u6c42ai\u7684\u5b50\u5e8f\u5217bi\u7684\u6700\u957f\u957f\u5ea6\uff0c\u6ee1\u8db3bi&amp;bi-1!=0(2&lt;=i&lt;=len)\u3002<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Input\"><\/span>Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<div>\u8f93\u5165\u6587\u4ef6\u51712\u884c\u3002<\/div>\n<div>\u7b2c\u4e00\u884c\u5305\u62ec\u4e00\u4e2a\u6574\u6570n\u3002<\/div>\n<div>\u7b2c\u4e8c\u884c\u5305\u62ecn\u4e2a\u6574\u6570\uff0c\u7b2ci\u4e2a\u6574\u6570\u8868\u793aai\u3002<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Output\"><\/span>Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<div>\u8f93\u51fa\u6587\u4ef6\u5171\u4e00\u884c\u3002<\/div>\n<div>\u5305\u62ec\u4e00\u4e2a\u6574\u6570\uff0c\u8868\u793a\u5b50\u5e8f\u5217bi\u7684\u6700\u957f\u957f\u5ea6\u3002<\/div>\n<div><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Input\"><\/span>Sample Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">3<br \/>\n1 2 3<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Output\"><\/span>Sample Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">2<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"HINT\"><\/span>HINT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>&nbsp;<\/p>\n<p>n&lt;=100000,ai&lt;=2*10^9<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Source\"><\/span>Source<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:c++ decode:true \">#include&lt;cstdio&gt;\r\n#define N 100010\r\ninline int max(int a,int b){return a&gt;b?a:b;}\r\ninline int read()\r\n{\r\n    int tmp=0;\r\n    char ch=getchar();\r\n    while(ch&lt;'0'||ch&gt;'9') ch=getchar();\r\n    while(ch&gt;='0'&amp;&amp;ch&lt;='9'){tmp=tmp*10+ch-'0';ch=getchar();}\r\n    return tmp;\r\n}\r\nint t,n,a[N],f[33],ans;\r\nint main()\r\n{\r\n    n=read();\r\n    for(int i=0;i&lt;n;i++)\r\n    {\r\n        t=read();\r\n        int tmp=0;\r\n        for(int j=0;j&lt;31;j++)\r\n        if(t&amp;(1&lt;&lt;j)) tmp=max(f[j]+1,tmp);\r\n        for(int j=0;j&lt;31;j++)\r\n        if(t&amp;(1&lt;&lt;j)) f[j]=tmp;\r\n        ans=max(ans,tmp);\r\n    }\r\n    printf(\"%d\",ans);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>4300: \u7edd\u4e16\u597d\u9898 Time Limit:\u00a01 Sec\u00a0\u00a0Memory Limit:\u00a0128 MB Desc [&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":[5],"class_list":["post-309","post","type-post","status-publish","format-standard","hentry","category-bzoj","tag-dp"],"_links":{"self":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/309","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=309"}],"version-history":[{"count":1,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/309\/revisions"}],"predecessor-version":[{"id":310,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/309\/revisions\/310"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}