{"id":904,"date":"2024-06-16T15:51:55","date_gmt":"2024-06-16T07:51:55","guid":{"rendered":"https:\/\/seanxd.com\/?p=904"},"modified":"2024-06-16T20:34:49","modified_gmt":"2024-06-16T12:34:49","slug":"zerojudge-o076","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-o076\/","title":{"rendered":"ZeroJudge O076: \u7279\u6280\u8868\u6f14"},"content":{"rendered":"\n\n\n<p>\u6709\u4e00\u500b\u57ce\u93ae\u6709 N \u68df\u9ad8\u6a13\uff0c\u6a13\u9ad8\u5206\u5225\u70ba H<sub>1<\/sub>\u3001H<sub>2<\/sub>\u3001&#8230;\u3001H<sub>N<\/sub>\uff0c\u5e02\u9577\u60f3\u8981\u5728\u57ce\u93ae\u4e2d\u5fc3\u8209\u8fa6\u9ad8\u7a7a\u7279\u6280\u8868\u6f14\uff0c\u8a72\u7279\u6280\u8868\u6f14\u6703\u5f9e\u67d0\u68df\u5927\u6a13\u4e0a\u671d\u53f3\u5074\u6ed1\u7fd4\u81f3\u5730\u9762\u3002<\/p>\n\n\n\n<p>\u70ba\u4e86\u8868\u6f14\u4eba\u54e1\u7684\u5b89\u5168\uff0c<strong>\u6ed1\u7fd4\u7684\u8def\u5f91\u6a13\u9ad8\u5fc5\u9808\u8d8a\u4f86\u8d8a\u4f4e\uff0c\u8acb\u4f60\u627e\u51fa\u4e00\u500b\u6700\u9577\u7684\u6ed1\u7fd4\u8def\u5f91<\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7bc4\u4f8b\u6e2c\u8cc7<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td>\u7b2c\u4e00\u884c\u6709\u4e00\u500b\u6b63\u6574\u6578 N (5 &lt;= N &lt;= 100)\u3002<br>\u7b2c\u4e8c\u884c\u6709 N \u500b\u6b63\u6574\u6578 H<sub>1<\/sub>\u3001H<sub>2<\/sub>\u3001&#8230;\u3001H<sub>N<\/sub> (1 &lt;= H<sub>i<\/sub> &lt;= 1000)\u4ee3\u8868\u6a13\u9ad8\u3002<\/td><td>\u8f38\u51fa\u6700\u9577\u7684\u6ed1\u7fd4\u8def\u5f91\u9577\u5ea6\u3002<\/td><\/tr><tr><td>5<br>6 2 5 3 1<\/td><td>3<\/td><\/tr><tr><td>10<br>31 41 97 93 23 89 59 26 15 58<\/td><td>4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p>\u6536\u8cc7\u6599\u7684\u6642\u5019\u5c07\u6578\u5b57\u90fd\u6536\u5230\u4e00\u500b\u9663\u5217\u4e2d\uff0c<strong>\u5982\u679c\u76ee\u524d\u6536\u5230\u7684\u6578\u5b57\u975e\u7b2c\u4e00\u500b\u6578\u5b57\u5247\u548c\u9663\u5217\u4e2d\u524d\u9762\u7684\u6578\u503c\u6bd4\u5927\u5c0f<\/strong>\u3002\u5ba3\u544a\u4e00\u500b len \u8b8a\u6578\u4f86\u5b58\u300c\u76ee\u524d\u905e\u6e1b\u5b50\u5340\u9593\u9577\u5ea6\u300d\uff0c\u9084\u6709\u4e00\u500b max \u8b8a\u6578\u4f86\u5b58\u300c\u6700\u9577\u905e\u6e1b\u5b50\u5340\u9593\u9577\u5ea6\u300d\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u76ee\u524d\u6536\u5230\u7684\u6578\u5b57\u6bd4\u4e0a\u4e00\u500b\u6578\u5b57\u9084\u8981\u5c0f\uff0c\u5247 len++\u3002\u5426\u5247\u5c07 len = 1\u3002\u6bcf\u4e00\u6b21\u505a\u9019\u500b\u5224\u65b7\u6642\u90fd\u8981\u548c max \u505a\u6bd4\u8f03\uff0c\u5982\u679c len &gt; max \u5247 max = len\u3002\u6700\u5f8c\u8f38\u51fa max \u5373\u53ef\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=o076\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge O076: \u7279\u6280\u8868\u6f14<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\n#include &lt;vector&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int N;\n    cin &gt;&gt; N;\n    vector&lt;int&gt;num;\n    int len = 1, max = -1;\n    for (int i = 0; i&lt;N; i++) {\n        int tmp;\n        cin &gt;&gt; tmp;\n        num.push_back(tmp);\n        if (i != 0) {\n            if (tmp &lt; num[i-1]) len++;\n            else len = 1;\n            if (len &gt; max) max = len;\n        }\n    }\n    cout &lt;&lt; max &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge O076\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e00\u500b\u57ce\u93ae\u6709 N \u68df\u9ad8\u6a13\uff0c\u6a13\u9ad8\u5206\u5225\u70ba H1\u3001H2\u3001&#8230;\u3001HN\uff0c\u5e02\u9577\u60f3\u8981\u5728\u57ce\u93ae\u4e2d\u5fc3\u8209\u8fa6\u9ad8\u7a7a\u7279\u6280\u8868\u6f14\uff0c\u8a72 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[25],"tags":[20,8,9],"class_list":["post-904","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-20","tag-8","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/comments?post=904"}],"version-history":[{"count":4,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/904\/revisions"}],"predecessor-version":[{"id":913,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/904\/revisions\/913"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}