{"id":7,"date":"2023-01-10T14:02:40","date_gmt":"2023-01-10T06:02:40","guid":{"rendered":"https:\/\/solost.cn\/?p=7"},"modified":"2023-01-10T14:02:40","modified_gmt":"2023-01-10T06:02:40","slug":"5","status":"publish","type":"post","link":"https:\/\/solost.cn\/?p=7","title":{"rendered":"\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217"},"content":{"rendered":"<h1>\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217<\/h1>\n<h2>\u6734\u7d20\u7248n^2^<\/h2>\n<pre><code class=\"C++\">#include &lt;bits\/stdc++.h&gt;\n\nusing namespace std;\nconst int N = 1010;\nint a[N], f[N];\nint main(){\n    int n;\n    cin &gt;&gt; n;\n    for(int i = 1; i &lt;= n; i ++) cin &gt;&gt; a[i];\n    for(int i = 1; i &lt;= n; i ++){\n        f[i] = 1;\n        for(int j = 1; j &lt; i; j ++)\n            if(a[i] &gt; a[j]) f[i] = max(f[i], f[j] + 1);\n    }\n    int ans = 0;\n    for(int i = 1; i &lt;= n; i ++) ans = max(ans, f[i]);\n    cout &lt;&lt; ans;\n    return 0;\n}<\/code><\/pre>\n<h2>\u4f18\u5316\u7248nlogn<\/h2>\n<pre><code class=\"C++\">#include &lt;bits\/stdc++.h&gt;\n\nusing namespace std;\nconst int N = 1e5 + 10;\nint a[N];\nint main(){\n    int n;\n    cin &gt;&gt; n;\n    vector&lt;int&gt; arr;\n    for(int i = 1; i &lt;= n; i ++) cin &gt;&gt; a[i];\n    arr.push_back(a[1]);\n    for(int i = 2; i &lt;= n; i ++){\n        if(a[i] &gt; arr.back()) arr.push_back(a[i]);\n        else *lower_bound(arr.begin(), arr.end(), a[i]) = a[i];\n    }\n    cout &lt;&lt; arr.size();\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u957f\u4e0a\u5347\u5b50\u5e8f\u5217 \u6734\u7d20\u7248n^2^ #include &lt;bits\/stdc++.h&gt; using namespace std; const int N = 1010; int a[N], f[N]; int main(){ int n; cin &gt;&gt; n; for(int i = 1; i &lt;= n; i ++) cin &gt;&gt; a[i]; for(int i = 1; i &lt;= n; i ++){ f[i] = 1; for(int j = 1; j &lt; i; j ++) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-acm"],"_links":{"self":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"}],"version-history":[{"count":0,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions"}],"wp:attachment":[{"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}