{"id":41414,"date":"2025-06-02T16:30:49","date_gmt":"2025-06-02T08:30:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/41414.html"},"modified":"2025-06-02T16:30:49","modified_gmt":"2025-06-02T08:30:49","slug":"%e6%af%8f%e6%97%a5%e4%b8%80%e9%a2%98-%e6%8f%90%e5%8f%96%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%89%a9%e6%96%99%e5%9e%8b%e5%8f%b7%e5%b9%b6%e7%bb%9f%e8%ae%a1%e5%87%ba%e7%8e%b0%e6%ac%a1%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/41414.html","title":{"rendered":"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570"},"content":{"rendered":"<\/p>\n<h4>\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570<\/h4>\n<ul>\n<li>\n<ul>\n<li>\u4e00\u3001\u9898\u76ee\u63cf\u8ff0<\/li>\n<li>\n<ul>\n<li>&#x1f4a1; \u8f93\u5165\u63cf\u8ff0&#xff1a;<\/li>\n<li>&#x1f4e4; \u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u6837\u4f8b\u793a\u4f8b<\/li>\n<li>\n<ul>\n<li>&#x1f3af; \u793a\u4f8b1<\/li>\n<li>&#x1f3af; \u793a\u4f8b2<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001\u89e3\u9898\u601d\u8def<\/li>\n<li>\n<ul>\n<li>1. \u5b50\u4e32\u63d0\u53d6\u7b56\u7565&#xff1a;\u6b63\u5219\u5339\u914d<\/li>\n<li>2. \u7edf\u8ba1\u7b56\u7565&#xff1a;\u54c8\u5e0c\u6620\u5c04<\/li>\n<li>3. \u8f93\u51fa\u7b56\u7565<\/li>\n<\/ul>\n<\/li>\n<li>\u56db\u3001\u590d\u6742\u5ea6\u5206\u6790<\/li>\n<li>\u4e94\u3001C&#043;&#043; \u4ee3\u7801\u5b9e\u73b0&#xff08;\u542b\u8be6\u7ec6\u6ce8\u91ca&#xff09;<\/li>\n<li>\u516d\u3001\u603b\u7ed3\u4e0e\u62d3\u5c55<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5728\u4f01\u4e1aIT\u8fd0\u7ef4\u6216\u62a5\u5e9f\u8d44\u4ea7\u7ba1\u7406\u4e2d&#xff0c;\u5206\u6790\u5404\u53f0\u670d\u52a1\u5668\u4e0a\u7684CPU\u3001\u5185\u5b58\u3001\u4e3b\u677f\u578b\u53f7&#xff0c;\u5e76\u7edf\u8ba1\u53ef\u56de\u6536\u914d\u4ef6\u7684\u6570\u91cf&#xff0c;\u662f\u4e00\u4e2a\u5178\u578b\u7684\u6587\u672c\u5904\u7406\u4e0e\u7edf\u8ba1\u95ee\u9898\u3002<\/p>\n<p>\u672c\u9898\u6a21\u62df\u4e86\u8fd9\u6837\u7684\u573a\u666f&#xff0c;\u7ed9\u5b9a\u6bcf\u53f0\u670d\u52a1\u5668\u7684\u7269\u6599\u7f16\u7801\u5b57\u7b26\u4e32&#xff0c;\u6211\u4eec\u8981\u4ece\u4e2d\u63d0\u53d6\u51fa\u6bcf\u7c7b\u5907\u4ef6\u7684\u9996\u4e2a\u578b\u53f7\u6807\u8bc6&#xff0c;\u7edf\u8ba1\u6240\u6709\u670d\u52a1\u5668\u4e0a\u6bcf\u79cd\u578b\u53f7\u7684\u6570\u91cf&#xff0c;\u5e76\u6309\u5b57\u5178\u5e8f\u8f93\u51fa\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u9898\u76ee\u63cf\u8ff0<\/h3>\n<h4>&#x1f4a1; \u8f93\u5165\u63cf\u8ff0&#xff1a;<\/h4>\n<ul>\n<li>\u7b2c\u4e00\u884c\u4e3a\u4e00\u4e2a\u6574\u6570 $N$&#xff0c;\u8868\u793a\u670d\u52a1\u5668\u7684\u6570\u91cf&#xff0c;$1 \\\\leq N \\\\leq 1000$&#xff1b;<\/li>\n<li>\u7b2c\u4e8c\u884c\u4e3a $N$ \u4e2a\u7269\u6599\u7f16\u7801\u5b57\u7b26\u4e32&#xff0c;\u4f7f\u7528\u7a7a\u683c\u9694\u5f00\u3002\u6bcf\u4e2a\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u8d85\u8fc7 $100$&#xff0c;\u5305\u542b\u5b57\u6bcd\u548c\u6570\u5b57\u3002<\/li>\n<\/ul>\n<p>\u6bcf\u4e2a\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u82e5\u5e72\u6bb5\u4ee3\u8868\u914d\u4ef6\u578b\u53f7\u7684\u5b50\u4e32&#xff1a;<\/p>\n<ul>\n<li>CPU \u578b\u53f7\u683c\u5f0f\u4e3a&#xff1a;C &#043; \u4e24\u4f4d\u6570\u5b57&#xff0c;\u4f8b\u5982&#xff1a;C01&#xff1b;<\/li>\n<li>\u5185\u5b58\u578b\u53f7\u683c\u5f0f\u4e3a&#xff1a;M &#043; \u4e24\u4f4d\u6570\u5b57&#xff0c;\u4f8b\u5982&#xff1a;M23&#xff1b;<\/li>\n<li>\u4e3b\u677f\u578b\u53f7\u683c\u5f0f\u4e3a&#xff1a;B &#043; \u4e24\u4f4d\u6570\u5b57&#xff0c;\u4f8b\u5982&#xff1a;B05\u3002<\/li>\n<\/ul>\n<p>\u6ce8\u610f&#xff1a;\u6bcf\u7c7b\u5907\u4ef6\u7684\u578b\u53f7\u53ef\u80fd\u51fa\u73b0\u591a\u6b21&#xff0c;\u4f46\u6211\u4eec\u53ea\u53d6\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u3002<\/p>\n<hr \/>\n<h4>&#x1f4e4; \u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/h4>\n<p>\u5171\u4e09\u884c\u8f93\u51fa&#xff0c;\u6bcf\u884c\u5bf9\u5e94\u4e00\u7c7b\u914d\u4ef6\u7684\u578b\u53f7\u7edf\u8ba1&#xff1a;<\/p>\n<ul>\n<li>\u7b2c\u4e00\u884c\u4e3a CPU \u578b\u53f7&#xff1b;<\/li>\n<li>\u7b2c\u4e8c\u884c\u4e3a\u5185\u5b58\u578b\u53f7&#xff1b;<\/li>\n<li>\u7b2c\u4e09\u884c\u4e3a\u4e3b\u677f\u578b\u53f7\u3002<\/li>\n<\/ul>\n<p>\u683c\u5f0f\u8981\u6c42\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u578b\u53f7\u53ca\u5176\u6570\u91cf\u7528 \u578b\u53f7,\u6570\u91cf \u8868\u793a&#xff1b;<\/li>\n<li>\u591a\u4e2a\u578b\u53f7\u4e4b\u95f4\u7528\u82f1\u6587\u5206\u53f7 ; \u5206\u9694&#xff1b;<\/li>\n<li>\u76f8\u540c\u7c7b\u7684\u578b\u53f7\u9700\u6309\u7167\u5b57\u5178\u5e8f\u5347\u5e8f\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e8c\u3001\u6837\u4f8b\u793a\u4f8b<\/h3>\n<h4>&#x1f3af; \u793a\u4f8b1<\/h4>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>2<br \/>\nC01M23B050130 C01M23B060130<\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>C01,2<br \/>\nM23,2<br \/>\nB05,1;B06,1<\/p>\n<h4>&#x1f3af; \u793a\u4f8b2<\/h4>\n<p>\u8f93\u5165&#xff1a;<\/p>\n<p>3<br \/>\nC0CM23B05C130X11 C01M23B050130Y22 C01M24B05C130Z33<\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>C01,2;C13,1<br \/>\nM23,2;M24,1<br \/>\nB05,3<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u89e3\u9898\u601d\u8def<\/h3>\n<h4>1. \u5b50\u4e32\u63d0\u53d6\u7b56\u7565&#xff1a;\u6b63\u5219\u5339\u914d<\/h4>\n<ul>\n<li>\n<p>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u7b2c\u4e00\u4e2a\u5339\u914d\u7684\u578b\u53f7\u5b50\u4e32&#xff1a;<\/p>\n<ul>\n<li>CPU&#xff1a;C\\\\d{2}<\/li>\n<li>\u5185\u5b58&#xff1a;M\\\\d{2}<\/li>\n<li>\u4e3b\u677f&#xff1a;B\\\\d{2}<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f7f\u7528 regex_search \u83b7\u53d6\u9996\u6b21\u51fa\u73b0\u7684\u5bf9\u5e94\u5b50\u4e32\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u7edf\u8ba1\u7b56\u7565&#xff1a;\u54c8\u5e0c\u6620\u5c04<\/h4>\n<ul>\n<li>\u4f7f\u7528 map&lt;string, int&gt; \u8bb0\u5f55\u6bcf\u7c7b\u5907\u4ef6\u7684\u578b\u53f7\u53ca\u5176\u51fa\u73b0\u6b21\u6570\u3002<\/li>\n<\/ul>\n<h4>3. \u8f93\u51fa\u7b56\u7565<\/h4>\n<ul>\n<li>\u5bf9\u6bcf\u7c7b map \u7684 key \u8fdb\u884c\u5b57\u5178\u5e8f\u6392\u5e8f&#xff08;map \u672c\u8eab\u5df2\u6309\u5b57\u5178\u5e8f&#xff09;&#xff0c;\u683c\u5f0f\u5316\u8f93\u51fa\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u56db\u3001\u590d\u6742\u5ea6\u5206\u6790<\/h3>\n<ul>\n<li>\n<p>\u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a $L$&#xff0c;\u67e5\u627e3\u7c7b\u578b\u53f7 $O(L)$&#xff0c;\u603b\u5171 $N$ \u4e2a\u5b57\u7b26\u4e32&#xff0c;\u6545\u4e3a $O(NL)$&#xff1b;<\/li>\n<li>\u6bcf\u7c7b map \u7684\u6392\u5e8f\u4e3a $O(K\\\\log K)$&#xff0c;\u5176\u4e2d $K$ \u4e3a\u4e0d\u540c\u578b\u53f7\u6570\u91cf&#xff0c;\u901a\u5e38\u8fdc\u5c0f\u4e8e $NL$\u3002<\/li>\n<li>\u603b\u4f53\u4e3a&#xff1a;$O(NL &#043; K\\\\log K)$\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;<\/p>\n<ul>\n<li>\u8f93\u5165\u4e3a $O(NL)$&#xff1b;<\/li>\n<li>\u4e09\u4e2a map \u7684\u7a7a\u95f4\u4e3a $O(K)$\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e94\u3001C&#043;&#043; \u4ee3\u7801\u5b9e\u73b0&#xff08;\u542b\u8be6\u7ec6\u6ce8\u91ca&#xff09;<\/h3>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;bits\/stdc&#043;&#043;.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token keyword\">namespace<\/span> std<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    ios<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">sync_with_stdio<\/span><span class=\"token punctuation\">(<\/span><span class=\"token boolean\">false<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u63d0\u9ad8 cin\/cout \u6548\u7387<\/span><br \/>\n    cin<span class=\"token punctuation\">.<\/span><span class=\"token function\">tie<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">nullptr<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>            <span class=\"token comment\">\/\/ \u7981\u6b62 cin \u4e0e stdout \u540c\u6b65&#xff0c;\u63d0\u9ad8\u6027\u80fd<\/span><\/p>\n<p>    <span class=\"token keyword\">int<\/span> n<span class=\"token punctuation\">;<\/span><br \/>\n    cin <span class=\"token operator\">&gt;&gt;<\/span> n<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u8f93\u5165\u670d\u52a1\u5668\u6570\u91cf<\/span><\/p>\n<p>    vector<span class=\"token operator\">&lt;<\/span>string<span class=\"token operator\">&gt;<\/span> <span class=\"token function\">codes<\/span><span class=\"token punctuation\">(<\/span>n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7528\u4e8e\u5b58\u50a8\u6bcf\u53f0\u670d\u52a1\u5668\u7684\u7269\u6599\u7f16\u7801<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> n<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        cin <span class=\"token operator\">&gt;&gt;<\/span> codes<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u8bfb\u5165\u6bcf\u4e2a\u7f16\u7801\u5b57\u7b26\u4e32<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u4e09\u4e2a map \u5206\u522b\u7edf\u8ba1 CPU\u3001\u5185\u5b58\u3001\u4e3b\u677f\u7684\u578b\u53f7\u53ca\u5176\u6570\u91cf<\/span><br \/>\n    map<span class=\"token operator\">&lt;<\/span>string<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span><span class=\"token operator\">&gt;<\/span> cpuMap<span class=\"token punctuation\">,<\/span> memMap<span class=\"token punctuation\">,<\/span> boaMap<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u4e09\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f&#xff08;\u5339\u914d\u683c\u5f0f&#xff1a;\u5b57\u6bcd &#043; \u4e24\u4f4d\u6570\u5b57&#xff09;<\/span><br \/>\n    regex <span class=\"token function\">rc<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;C\\\\\\\\d{2}&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5339\u914d C01\u3001C13 \u7b49<\/span><br \/>\n    regex <span class=\"token function\">rm<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;M\\\\\\\\d{2}&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5339\u914d M23 \u7b49<\/span><br \/>\n    regex <span class=\"token function\">rb<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;B\\\\\\\\d{2}&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5339\u914d B05\u3001B06 \u7b49<\/span><\/p>\n<p>    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">auto<\/span> <span class=\"token operator\">&amp;<\/span>s <span class=\"token operator\">:<\/span> codes<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        smatch m<span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u67e5\u627e CPU \u578b\u53f7<\/span><br \/>\n        string cpu <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">regex_search<\/span><span class=\"token punctuation\">(<\/span>s<span class=\"token punctuation\">,<\/span> m<span class=\"token punctuation\">,<\/span> rc<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> cpu <span class=\"token operator\">&#061;<\/span> m<span class=\"token punctuation\">.<\/span><span class=\"token function\">str<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u67e5\u627e\u5185\u5b58\u578b\u53f7<\/span><br \/>\n        string mem <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">regex_search<\/span><span class=\"token punctuation\">(<\/span>s<span class=\"token punctuation\">,<\/span> m<span class=\"token punctuation\">,<\/span> rm<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> mem <span class=\"token operator\">&#061;<\/span> m<span class=\"token punctuation\">.<\/span><span class=\"token function\">str<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u67e5\u627e\u4e3b\u677f\u578b\u53f7<\/span><br \/>\n        string boa <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">regex_search<\/span><span class=\"token punctuation\">(<\/span>s<span class=\"token punctuation\">,<\/span> m<span class=\"token punctuation\">,<\/span> rb<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> boa <span class=\"token operator\">&#061;<\/span> m<span class=\"token punctuation\">.<\/span><span class=\"token function\">str<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u66f4\u65b0\u4e09\u4e2a map \u4e2d\u7684\u6570\u91cf\u7edf\u8ba1<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>cpu<span class=\"token punctuation\">.<\/span><span class=\"token function\">empty<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> cpuMap<span class=\"token punctuation\">[<\/span>cpu<span class=\"token punctuation\">]<\/span><span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>mem<span class=\"token punctuation\">.<\/span><span class=\"token function\">empty<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> memMap<span class=\"token punctuation\">[<\/span>mem<span class=\"token punctuation\">]<\/span><span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>boa<span class=\"token punctuation\">.<\/span><span class=\"token function\">empty<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> boaMap<span class=\"token punctuation\">[<\/span>boa<span class=\"token punctuation\">]<\/span><span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u8f93\u51fa\u51fd\u6570&#xff1a;\u6309\u683c\u5f0f\u8f93\u51fa map \u5185\u5bb9<\/span><br \/>\n    <span class=\"token keyword\">auto<\/span> printMap <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">const<\/span> map<span class=\"token operator\">&lt;<\/span>string<span class=\"token punctuation\">,<\/span><span class=\"token keyword\">int<\/span><span class=\"token operator\">&gt;<\/span><span class=\"token operator\">&amp;<\/span> M<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">bool<\/span> first <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">auto<\/span> <span class=\"token operator\">&amp;<\/span>p <span class=\"token operator\">:<\/span> M<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>first<span class=\"token punctuation\">)<\/span> cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;;&#034;<\/span><span class=\"token punctuation\">;<\/span>           <span class=\"token comment\">\/\/ \u591a\u4e2a\u578b\u53f7\u4e4b\u95f4\u52a0\u5206\u53f7<\/span><br \/>\n            cout <span class=\"token operator\">&lt;&lt;<\/span> p<span class=\"token punctuation\">.<\/span>first <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;,&#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> p<span class=\"token punctuation\">.<\/span>second<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u578b\u53f7,\u6570\u91cf<\/span><br \/>\n            first <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">false<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n        cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u4f9d\u6b21\u8f93\u51fa CPU\u3001\u5185\u5b58\u3001\u4e3b\u677f\u578b\u53f7\u7edf\u8ba1<\/span><br \/>\n    <span class=\"token function\">printMap<\/span><span class=\"token punctuation\">(<\/span>cpuMap<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printMap<\/span><span class=\"token punctuation\">(<\/span>memMap<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">printMap<\/span><span class=\"token punctuation\">(<\/span>boaMap<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h3>\u516d\u3001\u603b\u7ed3\u4e0e\u62d3\u5c55<\/h3>\n<p>\u672c\u9898\u8003\u67e5\u4e86&#xff1a;<\/p>\n<ul>\n<li>\u5b57\u7b26\u4e32\u5339\u914d\u4e0e\u63d0\u53d6&#xff1a;\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9ad8\u6548\u63d0\u53d6\u6307\u5b9a\u683c\u5f0f\u5b50\u4e32&#xff1b;<\/li>\n<li>\u54c8\u5e0c\u7edf\u8ba1\u4e0e\u6392\u5e8f\u8f93\u51fa&#xff1a;\u7ed3\u5408 map \u548c\u683c\u5f0f\u63a7\u5236\u5b8c\u6210\u9700\u6c42&#xff1b;<\/li>\n<li>\u6570\u636e\u7ed3\u6784\u9009\u578b\u4e0e\u6027\u80fd\u63a7\u5236&#xff1a;\u5408\u7406\u5229\u7528 STL \u7684\u7279\u6027\u7b80\u5316\u5b9e\u73b0&#xff1b;<\/li>\n<\/ul>\n<p>\u9002\u5408\u4f5c\u4e3a C&#043;&#043; \u57fa\u7840\u7ec3\u4e60\u9898&#xff0c;\u4e5f\u53ef\u4ee5\u62d3\u5c55\u5230\u66f4\u590d\u6742\u7684\u65e5\u5fd7\u89e3\u6790\u6216\u914d\u7f6e\u63d0\u53d6\u4efb\u52a1\u4e2d\u3002<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb830\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf6\u6b21\u3002\u5728\u4f01\u4e1aIT\u8fd0\u7ef4\u6216\u62a5\u5e9f\u8d44\u4ea7\u7ba1\u7406\u4e2d\uff0c\u5206\u6790\u5404\u53f0\u670d\u52a1\u5668\u4e0a\u7684CPU\u3001\u5185\u5b58\u3001\u4e3b\u677f\u578b\u53f7\uff0c\u5e76\u7edf\u8ba1\u53ef\u56de\u6536\u914d\u4ef6\u7684\u6570\u91cf\uff0c\u662f\u4e00\u4e2a\u5178\u578b\u7684\u6587\u672c\u5904\u7406\u4e0e\u7edf\u8ba1\u95ee\u9898\u3002\u672c\u9898\u6a21\u62df\u4e86\u8fd9\u6837\u7684\u573a\u666f\uff0c\u7ed9\u5b9a\u6bcf\u53f0\u670d\u52a1\u5668\u7684\u7269\u6599\u7f16\u7801\u5b57\u7b26\u4e32\uff0c\u6211\u4eec\u8981\u4ece\u4e2d\u63d0\u53d6\u51fa\u6bcf\u7c7b\u5907\u4ef6\u7684**\u9996\u4e2a\u578b\u53f7\u6807\u8bc6**\uff0c\u7edf\u8ba1\u6240\u6709\u670d\u52a1\u5668\u4e0a\u6bcf\u79cd\u578b\u53f7\u7684\u6570\u91cf\uff0c\u5e76\u6309\u5b57\u5178\u5e8f\u8f93\u51fa\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,3351,1813,427,3531,2757],"topic":[],"class_list":{"0":"post-41414","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-c","9":"tag-1813","10":"tag-427","11":"tag-3531","12":"tag-2757"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/41414.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb830\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf6\u6b21\u3002\u5728\u4f01\u4e1aIT\u8fd0\u7ef4\u6216\u62a5\u5e9f\u8d44\u4ea7\u7ba1\u7406\u4e2d\uff0c\u5206\u6790\u5404\u53f0\u670d\u52a1\u5668\u4e0a\u7684CPU\u3001\u5185\u5b58\u3001\u4e3b\u677f\u578b\u53f7\uff0c\u5e76\u7edf\u8ba1\u53ef\u56de\u6536\u914d\u4ef6\u7684\u6570\u91cf\uff0c\u662f\u4e00\u4e2a\u5178\u578b\u7684\u6587\u672c\u5904\u7406\u4e0e\u7edf\u8ba1\u95ee\u9898\u3002\u672c\u9898\u6a21\u62df\u4e86\u8fd9\u6837\u7684\u573a\u666f\uff0c\u7ed9\u5b9a\u6bcf\u53f0\u670d\u52a1\u5668\u7684\u7269\u6599\u7f16\u7801\u5b57\u7b26\u4e32\uff0c\u6211\u4eec\u8981\u4ece\u4e2d\u63d0\u53d6\u51fa\u6bcf\u7c7b\u5907\u4ef6\u7684**\u9996\u4e2a\u578b\u53f7\u6807\u8bc6**\uff0c\u7edf\u8ba1\u6240\u6709\u670d\u52a1\u5668\u4e0a\u6bcf\u79cd\u578b\u53f7\u7684\u6570\u91cf\uff0c\u5e76\u6309\u5b57\u5178\u5e8f\u8f93\u51fa\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/41414.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-02T08:30:49+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41414.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/41414.html\",\"name\":\"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-02T08:30:49+00:00\",\"dateModified\":\"2025-06-02T08:30:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/41414.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/41414.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/41414.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/41414.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb830\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf6\u6b21\u3002\u5728\u4f01\u4e1aIT\u8fd0\u7ef4\u6216\u62a5\u5e9f\u8d44\u4ea7\u7ba1\u7406\u4e2d\uff0c\u5206\u6790\u5404\u53f0\u670d\u52a1\u5668\u4e0a\u7684CPU\u3001\u5185\u5b58\u3001\u4e3b\u677f\u578b\u53f7\uff0c\u5e76\u7edf\u8ba1\u53ef\u56de\u6536\u914d\u4ef6\u7684\u6570\u91cf\uff0c\u662f\u4e00\u4e2a\u5178\u578b\u7684\u6587\u672c\u5904\u7406\u4e0e\u7edf\u8ba1\u95ee\u9898\u3002\u672c\u9898\u6a21\u62df\u4e86\u8fd9\u6837\u7684\u573a\u666f\uff0c\u7ed9\u5b9a\u6bcf\u53f0\u670d\u52a1\u5668\u7684\u7269\u6599\u7f16\u7801\u5b57\u7b26\u4e32\uff0c\u6211\u4eec\u8981\u4ece\u4e2d\u63d0\u53d6\u51fa\u6bcf\u7c7b\u5907\u4ef6\u7684**\u9996\u4e2a\u578b\u53f7\u6807\u8bc6**\uff0c\u7edf\u8ba1\u6240\u6709\u670d\u52a1\u5668\u4e0a\u6bcf\u79cd\u578b\u53f7\u7684\u6570\u91cf\uff0c\u5e76\u6309\u5b57\u5178\u5e8f\u8f93\u51fa\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/41414.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-02T08:30:49+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/41414.html","url":"https:\/\/www.wsisp.com\/helps\/41414.html","name":"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-02T08:30:49+00:00","dateModified":"2025-06-02T08:30:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/41414.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/41414.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/41414.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6bcf\u65e5\u4e00\u9898\u2014\u2014\u63d0\u53d6\u670d\u52a1\u5668\u7269\u6599\u578b\u53f7\u5e76\u7edf\u8ba1\u51fa\u73b0\u6b21\u6570"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=41414"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/41414\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=41414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=41414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=41414"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=41414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}