{"id":42,"date":"2016-05-11T15:22:11","date_gmt":"2016-05-11T07:22:11","guid":{"rendered":"http:\/\/tyswly.com\/?p=42"},"modified":"2016-05-11T15:22:11","modified_gmt":"2016-05-11T07:22:11","slug":"cogs-58%e5%bb%b6%e7%bb%b5%e7%9a%84%e5%b1%b1%e5%b3%b0","status":"publish","type":"post","link":"https:\/\/tys.fun\/?p=42","title":{"rendered":"[COGS 58]\u5ef6\u7ef5\u7684\u5c71\u5cf0"},"content":{"rendered":"<p>\u9898\u76ee\u6765\u81ea<a href=\"http:\/\/cogs.pro\/cogs\/problem\/problem.php?pid=58\">COGS<\/a><br \/>\n<del>\u7ef5\u5ef6<\/del>\u5ef6\u7ef5\u7684\u5c71\u5cf0\u8fd9\u9053\u9898\u554a\uff0c\u88f8\u7684\u7ebf\u6bb5\u6811\uff0c\u5e76\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u5c31\u7b97\u5230\u4e24\u661f\u534a\u7684\u96be\u5ea6\u4e86\u3002\u3002<br \/>\n\u5373\u4f7f\u662f\u4e00\u9053\u6c34\u9898\uff0c\u5e76\u4e0d\u6392\u9664\u7528\u9ad8\u7ea7\u7b97\u6cd5\u89e3\u51b3<del>\u6765\u5237rank<\/del>\u3002<br \/>\n\u8fd9\u51e0\u5929\u6211\u5927\u81f4\u7814\u7a76\u4e86\u4e00\u4e0bzkw\u7ebf\u6bb5\u6811\uff0c\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u4ece\u4e0b\u5230\u4e0a\u7684\u7ebf\u6bb5\u6811\u5c31\u662f\u5feb\u554a\uff0c\u819c\u62dc\u795e\u7287zkw\uff0c\u6211\u662f\u849f\u84bborz&#8230;.<br \/>\n\u4ee3\u7801\u5df2\u7ecf\u7528\u4e86\u6240\u6709\u6211\u80fd\u60f3\u5230\u7684\u5e38\u6570\u4f18\u5316\uff0c\u7136\u800c\u4f9d\u7136\u4e0d\u662frank1\uff0c\u8fd9\u5c31\u5f88\u5c34\u5c2c\u4e86\u3002\u3002\u3002<\/p>\n<pre class=\"lang:c++ decode:true \">#include &lt;iostream&gt;\n#include &lt;cstdio&gt;\n#include &lt;algorithm&gt;\n#define MX 1000010\nusing namespace std;\nint tree[MX&lt;&lt;2];\nint n, q, x, y, m, a;\ninline int get_num()\n{\n\tint ans=0;\n\tchar tmp;\n\twhile(tmp&lt;'0'||tmp&gt;'9')\ttmp=getchar();\n\twhile(tmp&gt;='0'&amp;&amp;tmp&lt;='9')\n\t{\n\t\tans=ans*10+tmp-48;\n\t\ttmp=getchar();\n\t}\n\treturn ans;\n}\nint main()\n{\n\t\/\/freopen(\"climb.in\",\"r\",stdin);\n\t\/\/freopen(\"climb.out\",\"w\",stdout);\n\tn=get_num();\n\tfor(m=1;m&lt;n+2;m&lt;&lt;=1);\n\tn++;\n\tfor(int i=1;i&lt;=n;i++)\n\t{\n\t\ttree[i+m]=get_num();\n\t}\n\tfor(int i=m-1;i&gt;=1;i--)\n\t\ttree[i]=max(tree[i&lt;&lt;1],tree[(i&lt;&lt;1)^1]);\n\tq=get_num();\n\tfor(int i=1;i&lt;=q;i++)\n\t{\n\t\tx=get_num()+1;y=get_num()+1;\n\t\ta=0;\n\t\tx=x+m-1;\n\t\ty=y+m+1;\n\t\tfor(;x^y^1;x&gt;&gt;=1,y&gt;&gt;=1)\n\t\t{\n\t\t\tif(!(x&amp;1))\n\t\t\t\ta=max(a,tree[x^1]);\n\t\t\tif(y&amp;1)\n\t\t\t\ta=max(a,tree[y^1]);\n\t\t}\n\t\tcout&lt;&lt;a&lt;&lt;\"\\n\";\n\t}\n\treturn 0;\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee\u6765\u81eaCOGS \u7ef5\u5ef6\u5ef6\u7ef5\u7684\u5c71\u5cf0\u8fd9\u9053\u9898\u554a\uff0c\u88f8\u7684\u7ebf\u6bb5\u6811\uff0c\u5e76\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\u5c31\u7b97\u5230\u4e24\u661f\u534a\u7684\u96be\u5ea6\u4e86\u3002\u3002 \u5373\u4f7f\u662f\u4e00\u9053\u6c34\u9898\uff0c &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-report"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=42"}],"version-history":[{"count":0,"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}