{"id":588,"date":"2019-02-04T17:04:01","date_gmt":"2019-02-04T09:04:01","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=588"},"modified":"2019-02-04T17:05:25","modified_gmt":"2019-02-04T09:05:25","slug":"cf1107","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2019\/02\/04\/cf1107\/","title":{"rendered":"CF1107"},"content":{"rendered":"\n<p>\u4e22\u4eba\u573a\u3002<br>C\u9898\u60f3\u4e86\u4e00\u4e2a\u5355\u8c03\u961f\u5217\u4f18\u5316DP\uff0c\u7136\u540e\u778ejb\u5199\uff0c\u6700\u540e\u8fd8\u662f\u522b\u4eba\u63d0\u9192\u4e86\u624d\u53d1\u73b0\u81ea\u5df1\u50bb\u4e86\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>CF1107A<br>\n\u663e\u7136\u5206\u6210\u4e24\u6bb5\uff1a\u7b2c\u4e00\u4e2a\u6570\u548c\u5269\u4e0b\u5168\u90e8\u7684\u6570\u662f\u6700\u5bb9\u6613\u60f3\u5230\u7684\uff0c\u4e5f\u4e00\u5b9a\u662f\u5408\u6cd5\u7684\u3002<br>\n\u5bf9\u4e8e\u53ea\u6709\u4e24\u4e2a\u5b57\u7b26\u7684\u8981\u7279\u6b8a\u5904\u7406\u3002 <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cstring>\n#include&lt;algorithm>\n#include&lt;queue>\n#include&lt;vector>\nusing namespace std;\n\nint n;\nchar ch[305];\n \nvoid init(){\n\tmemset(ch,0,sizeof(ch));\n\tscanf(\"%d\",&amp;n);\n\tcin>>ch+1;\n\tif(n==2&amp;&amp;ch[1]>=ch[2]){\n\t\tputs(\"NO\");\n\t\treturn;\n\t}\n\tputs(\"YES\");puts(\"2\");\n\tprintf(\"%c \",ch[1]);\n\tfor(int i=2;i&lt;=n;++i){\n\t\tputchar(ch[i]);\n\t}\n\tputs(\"\");\n}\nint main(){\n\tint T;\n\tscanf(\"%d\",&amp;T);\n\twhile(T--){\n\t\tinit();\n\t}\n\treturn 0;\n}\n\n\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>CF1107B<br>\n\u627e\u89c4\u5f8b\u9898\u3002\u6ca1\u4ec0\u4e48\u597d\u8bf4\u7684\u3002\u5f53\u7136\u8981\u8bc1\u660e\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u611f\u89c9\u7528\u5f52\u7eb3\u6cd5\u662f\u53ef\u4ee5\uff0c\u65f6\u95f4\u4e0d\u591f\u5c31\u6ca1\u6709\u8bc1\u660e\u4e86\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cstring>\n#include&lt;algorithm>\n#include&lt;queue>\n#include&lt;vector>\nusing namespace std;\n\nint n;\nlong long k,x,ans;\n\nvoid init(){\n\tscanf(\"%d\",&amp;n);\n\tfor(int i=1;i&lt;=n;++i){\n\t\tscanf(\"%I64d%I64d\",&amp;k,&amp;x);\n\t\tans=(k-1)*9+x;\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n}\nint main(){\n\tinit();\n\treturn 0;\n}\n\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>CF1107C<br>\n\u50bb\u903c\u8d2a\u5fc3\uff0c\u6211\u4e0d\u77e5\u9053\u6211\u600e\u4e48\u60f3\u6210\u5355\u8c03\u961f\u5217\u4f18\u5316DP\u7684\u3002<br>\n\u5177\u4f53\u6765\u8bf4\u5c31\u662f\u7528pq\u5c3d\u53ef\u80fd\u5220\u5c0f\u7684\u3002\u6b63\u786e\u6027\uff08\u53ef\u80fd\u4e00\u70b9\u90fd\u4e0d\uff09\u663e\u7136\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cstring>\n#include&lt;algorithm>\n#include&lt;queue>\n#include&lt;vector>\nusing namespace std;\n\npriority_queue&lt;int,vector&lt;int>,greater&lt;int> > q;\nchar ch[200005];\nint a[200005];\nvoid init(){\n\tint n,K;\n\tscanf(\"%d%d\",&amp;n,&amp;K);\n\tlong long ans=0;\n\tfor(int i=1;i&lt;=n;++i){\n\t\tscanf(\"%d\",&amp;a[i]);\n\t\tans+=a[i]; \n\t}\n\tcin>>ch+1;\n\tint tot=1;\n\tfor(int i=1;i&lt;=n;++i){\n\t\tif(ch[i]==ch[i-1]){\n\t\t\tq.push(a[i]);\n\t\t\t++tot;\n\t\t\twhile(tot>K&amp;&amp;!q.empty()){\n\t\t\t\tans-=q.top();\n\t\t\t\tq.pop();\n\t\t\t\t--tot;\n\t\t\t}\n\t\t}else{\n\t\t\ttot=1;\n\t\t\twhile(!q.empty()){\n\t\t\t\tq.pop();\n\t\t\t}\n\t\t\tq.push(a[i]);\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",ans);\n}\nint main(){\n\tinit();\n\treturn 0;\n}\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e22\u4eba\u573a\u3002C\u9898\u60f3\u4e86\u4e00\u4e2a\u5355\u8c03\u961f\u5217\u4f18\u5316DP\uff0c\u7136\u540e\u778ejb\u5199\uff0c\u6700\u540e\u8fd8\u662f\u522b\u4eba\u63d0\u9192\u4e86\u624d\u53d1\u73b0\u81ea\u5df1\u50bb\u4e86\u3002 CF1107A \u663e\u7136\u5206 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/SmokeyDays.top\/wordpress\/2019\/02\/04\/cf1107\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cCF1107\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,5],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/588"}],"collection":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/comments?post=588"}],"version-history":[{"count":1,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/588\/revisions"}],"predecessor-version":[{"id":589,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/588\/revisions\/589"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}