{"id":1333,"date":"2020-02-23T18:08:19","date_gmt":"2020-02-23T10:08:19","guid":{"rendered":"http:\/\/149.129.74.185\/?p=1333"},"modified":"2020-02-23T18:08:19","modified_gmt":"2020-02-23T10:08:19","slug":"bilibili-9%e9%a1%ba%e6%97%b6%e9%92%88%e6%89%93%e5%8d%b0%e6%95%b0%e5%ad%97%e7%9f%a9%e9%98%b5","status":"publish","type":"post","link":"http:\/\/www.magicmipamipa.com\/?p=1333","title":{"rendered":"[Bilibili] (9)\u987a\u65f6\u9488\u6253\u5370\u6570\u5b57\u77e9\u9635"},"content":{"rendered":"<h4 class=\"subject-item-title\" id=\"mcetoc_1e1oo609d0\">\u9898\u76ee\u63cf\u8ff0<\/h4>\n<div class=\"subject-describe\">\n<div class=\"js-question-content subject-question mb2\"><span>\u7ed9\u5b9a\u4e00\u4e2a\u6570\u5b57\u77e9\u9635\uff0c\u8bf7\u8bbe\u8ba1\u4e00\u4e2a\u7b97\u6cd5\u4ece\u5de6\u4e0a\u89d2\u5f00\u59cb\u987a\u65f6\u9488\u6253\u5370\u77e9\u9635\u5143\u7d20<\/span><\/div>\n<h4 id=\"mcetoc_1e1oo609d1\">\u8f93\u5165\u63cf\u8ff0:<\/h4>\n<pre>\u8f93\u5165\u7b2c\u4e00\u884c\u662f\u4e24\u4e2a\u6570\u5b57\uff0c\u5206\u522b\u4ee3\u8868\u884c\u6570M\u548c\u5217\u6570N\uff1b\u63a5\u4e0b\u6765\u662fM\u884c\uff0c\u6bcf\u884cN\u4e2a\u6570\u5b57\uff0c\u8868\u793a\u8fd9\u4e2a\u77e9\u9635\u7684\u6240\u6709\u5143\u7d20\uff1b\u5f53\u8bfb\u5230M=-1\uff0cN=-1\u65f6\uff0c\u8f93\u5165\u7ec8\u6b62\u3002<\/pre>\n<h4 id=\"mcetoc_1e1oo609d2\">\u8f93\u51fa\u63cf\u8ff0:<\/h4>\n<pre>\u8bf7\u6309\u9017\u53f7\u5206\u5272\u987a\u65f6\u9488\u6253\u5370\u77e9\u9635\u5143\u7d20\uff08\u6ce8\u610f\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u672b\u5c3e\u4e0d\u8981\u6709\u9017\u53f7\uff01\u4f8b\u5982\u8f93\u51fa\u201c1\uff0c2\uff0c3\u201d\uff0c\u800c\u4e0d\u662f\u201c1\uff0c2\uff0c\r\n3\uff0c\u201d\uff09\uff0c\u6bcf\u4e2a\u77e9\u9635\u8f93\u51fa\u5b8c\u6210\u540e\u8bb0\u5f97\u6362\u884c<\/pre>\n<div class=\"question-oi\">\n<div class=\"question-oi-hd\">\u793a\u4f8b1<\/div>\n<div class=\"question-oi-bd\">\n<div class=\"question-oi-mod\">\n<h4 id=\"mcetoc_1e1oo609d3\">\u8f93\u5165<\/h4>\n<div class=\"question-oi-cont\">\n<pre>3 3\r\n1 2 3\r\n4 5 6\r\n7 8 9\r\n-1 -1<\/pre>\n<\/div>\n<\/div>\n<div class=\"question-oi-mod\">\n<h4 id=\"mcetoc_1e1oo609e4\">\u8f93\u51fa<\/h4>\n<div class=\"question-oi-cont\">\n<pre>1,2,3,6,9,8,7,4,5<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h4 id=\"mcetoc_1e1oo609e5\">\u5907\u6ce8:<\/h4>\n<pre>M,N\u4e3a\u6b63\u6574\u6570\u4e14 M*N&lt;=300000<\/pre>\n<hr \/>\n<p>\u592a\u597d\u4e86\uff0c\u4e00\u9053\u7b7e\u5230\u9898\u7ed9\u6211\u6574\u81ea\u95ed\u4e86\u3002<\/p>\n<p>1.\u5927\u6570\u7ec4\u5f00\u5728\u5916\u9762\u3002<\/p>\n<p>2.\u8fde\u7b49a==b==c\u662f\u5148\u7b97\u51faa==b\u4e3atrue\u518d\u4e0ec\u6bd4\u8f83\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\">#include&lt;iostream&gt;\r\nusing namespace std;\r\nint mutex[300005];\r\nint isread[300005];\r\nint main(){\r\n    int m,n;\r\n    while(1){\r\n        cin &gt;&gt; m &gt;&gt; n;\r\n        if( m == n &amp;&amp; m == -1 )break;\r\n        for( int i = 0 ; i &lt; m ; i ++ ){\r\n            for( int j = 0 ; j &lt; n ; j ++ ){\r\n                cin &gt;&gt; mutex[i*n+j];\r\n                isread[i*n+j] = 0;\r\n            }\r\n        }\r\n        int row = 0,col = 0;\r\n        int count = 1;\r\n        printf(\"%d\",mutex[0]);\r\n        isread[0] = 1;\r\n        while(count != m*n){\r\n            while( col &lt; n-1 &amp;&amp; !isread[row*n+(col+1)] ){\r\n                printf(\",%d\",mutex[row*n+(++col)]);\r\n                isread[row*n+col] = 1;\r\n                count++;\r\n            }\r\n            while( row &lt; m-1 &amp;&amp; !isread[(row+1)*n+col] ){\r\n                printf(\",%d\",mutex[(++row)*n+col]);\r\n                isread[row*n+col] = 1;\r\n                count++;\r\n            }\r\n            while( col &gt; 0 &amp;&amp; !isread[row*n+(col-1)] ){\r\n                printf(\",%d\",mutex[row*n+(--col)]);\r\n                isread[row*n+col] = 1;\r\n                count++;  \r\n            }\r\n            while( row &gt; 0 &amp;&amp; !isread[(row-1)*n+col] ){\r\n                printf(\",%d\",mutex[(--row)*n+col]);\r\n                isread[row*n+col] = 1;\r\n                count++;  \r\n            }\r\n        }\r\n        printf(\"\\n\");\r\n    }\r\n    return 0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee\u63cf\u8ff0 \u7ed9\u5b9a\u4e00\u4e2a\u6570\u5b57\u77e9\u9635\uff0c\u8bf7\u8bbe\u8ba1\u4e00\u4e2a\u7b97\u6cd5\u4ece\u5de6\u4e0a\u89d2\u5f00\u59cb\u987a\u65f6\u9488\u6253\u5370\u77e9\u9635\u5143\u7d20 \u8f93\u5165\u63cf\u8ff0: \u8f93\u5165\u7b2c\u4e00\u884c\u662f\u4e24 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,35],"tags":[],"_links":{"self":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts\/1333"}],"collection":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1333"}],"version-history":[{"count":1,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts\/1333\/revisions"}],"predecessor-version":[{"id":1334,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=\/wp\/v2\/posts\/1333\/revisions\/1334"}],"wp:attachment":[{"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1333"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.magicmipamipa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}