{"id":443,"date":"2024-05-03T15:40:16","date_gmt":"2024-05-03T07:40:16","guid":{"rendered":"https:\/\/seanxd.com\/?p=443"},"modified":"2024-05-03T15:40:19","modified_gmt":"2024-05-03T07:40:19","slug":"zerojudge-e513","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-e513\/","title":{"rendered":"ZeroJudge E513: Symmetric Matrix"},"content":{"rendered":"\n\n\n<h4 class=\"wp-block-heading\">\u540c\u984c\uff1aUVa 11349 &#8211; Symmetric Matrix<\/h4>\n\n\n\n<p class=\"\">\u73fe\u5728\u7d66\u4f60\u4e00\u500b\u6b63\u65b9\u5f62\u77e9\u9663 M\u3002<br>M \u77e9\u9663\u7684\u5143\u7d20\u70baM[i][j]\uff1a{0 &lt; i &lt; N\uff0c0 &lt; j &lt; N}\u3002<br>\u5728\u9019\u500b\u554f\u984c\u4e2d\uff0c\u60a8\u5fc5\u9808\u627e\u51fa\u7d66\u5b9a\u7684\u77e9\u9663\u662f\u5426\u5c0d\u7a31 (Symmetric)\u3002<\/p>\n\n\n\n<p class=\"\">\u5b9a\u7fa9\uff1a\u5c0d\u7a31\u77e9\u9663\u6240\u6709\u5143\u7d20\u90fd\u662f\u975e\u8ca0\u7684\u4e26\u4e14\u76f8\u5c0d\u65bc\u8a72\u77e9\u9663\u7684\u4e2d\u5fc3\u5c0d\u7a31\u3002<br>\u4efb\u4f55\u5176\u4ed6\u77e9\u9663\u90fd\u88ab\u8a8d\u70ba\u662f\u975e\u5c0d\u7a31\u7684\u3002<\/p>\n\n\n\n<p class=\"\">\u4f60\u8981\u505a\u7684\u5c31\u662f\u5224\u65b7\u9019\u500b\u77e9\u9663\u662f\u5426\u5c0d\u7a31\u3002<br>\u77e9\u9663\u5167\u7684\u5143\u7d20\u7bc4\u570d\u70ba -2<sup>32<\/sup> &lt;= M[i][j] &lt;= 2<sup>32<\/sup> \u4e14 0 &lt; N &lt;= 100\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 nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td>\u8f38\u5165\u7684\u7b2c\u4e00\u884c\u5305\u542b\u4e00\u500b\u6578\u5b57 T (T &lt;= 300)\uff0c\u4ee3\u8868\u6e2c\u8cc7\u7684\u6578\u91cf\u3002<br>\u6bcf\u7d44\u6e2c\u8a66\u8cc7\u6599\u7684\u7b2c\u4e00\u884c\u5305\u542b\u5169\u500b\u5b57\u5143\u4e00\u500b\u6574\u6578 N\uff0cN \u4ee3\u8868\u9019\u500b\u6b63\u65b9\u77e9\u9663\u7684\u7dad\u5ea6\u3002<br>\u63a5\u4e0b\u4f86\u7684 N \u884c\u5373\u70ba\u9019\u500b\u77e9\u9663\u5167\u7684\u5143\u7d20\u6578\u503c\u3002<br>\u6bcf\u4e00\u5217 i \u6709 N \u500b\u6578\u5b57\uff0c\u7b2ci\u5217\u7684\u7b2cj\u500b\u6578\u5b57\u5373\u662fM[i][j]\u3002<\/td><td>\u5c0d\u6bcf\u4e00\u7b46\u6e2c\u8a66\u8cc7\u6599\u8f38\u51fa\u4e00\u884c\u300cTest #t: S\u300d\uff0ct \u70ba\u7b2c\u5e7e\u7b46\u6e2c\u8a66\u8cc7\u6599\u7684\u7de8\u865f\uff0cS \u70ba\u7b54\u6848\u5b57\u4e32\u3002<br>\u5982\u679c\u8f38\u5165\u7684\u77e9\u9663\u662f\u5c0d\u7a31\u77e9\u9663\uff0cS = \u300cSymmetric\u300d\u3002<br>\u5982\u679c\u8f38\u5165\u7684\u77e9\u9663\u4e0d\u662f\u5c0d\u7a31\u77e9\u9663\uff0cS =\u300cNon-symmetric\u300d\u3002<\/td><\/tr><tr><td>2<br>N = 3<br>5 1 3<br>2 0 2<br>3 1 5<br>N = 3<br>5 1 3<br>2 0 2<br>0 1 5<\/td><td>Test #1: Symmetric.<br>Test #2: Non-symmetric.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p class=\"\">\u672c\u984c\u9700\u4f7f\u7528 Long Long Int \u4f86\u5b58\u77e9\u9663\u4e2d\u7684\u8cc7\u6599\uff0c\u6536\u8cc7\u6599\u7684\u6642\u5019<strong>\u5982\u679c\u6709\u6536\u5230\u5c0f\u65bc 0 \u7684\u6578\u5b57\uff0c\u53ef\u4ee5\u9810\u8a2d\u4e00\u500b\u5e03\u6797\u503c\uff0c\u4e4b\u5f8c\u5c31\u4e0d\u7528\u9032\u884c\u5224\u65b7<\/strong>\u3002<\/p>\n\n\n\n<p class=\"\">\u53ef\u4ee5<strong>\u5c07\u77e9\u9663\u4e2d\u7684\u8cc7\u6599\u6536\u6210\u4e00\u7dad\u9663\u5217<\/strong>\uff0c\u7136\u5f8c<strong>\u5224\u65b7\u9019\u500b\u4e00\u7dad\u9663\u5217\u662f\u5426\u662f\u8ff4\u6587<\/strong>\uff0c\u9019\u6a23\u5c31\u53ef\u4ee5\u5224\u65b7\u9019\u500b\u77e9\u9663\u662f\u5426\u662f\u5c0d\u7a31\u7684\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=e513\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge E513: Symmetric Matrix<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-50\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\n#include &lt;vector&gt;\n#include &lt;algorithm&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    for (int i = 0; i&lt;N; i++)\n    {\n        char a, b;\n        int M;\n        cin &gt;&gt; a &gt;&gt; b &gt;&gt; M;\n        vector&lt;long long int&gt;num;\n        bool negative = false;\n        for (int j = 0; j&lt;M; j++)\n        {\n            for (int k = 0; k&lt;M; k++)\n            {\n                long long int tmp;\n                cin &gt;&gt; tmp;\n                num.push_back(tmp);\n                if (tmp &lt; 0) negative = true;\n            }\n        }\n        if (!negative)\n        {\n            vector&lt;long long int&gt;tmp = num;\n            reverse(tmp.begin(), tmp.end());\n            if (tmp == num) cout &lt;&lt; &quot;Test #&quot; &lt;&lt; i+1 &lt;&lt; &quot;: Symmetric.\\n&quot;;\n            else cout &lt;&lt; &quot;Test #&quot; &lt;&lt; i+1 &lt;&lt; &quot;: Non-symmetric.\\n&quot;;\n        }\n        else cout &lt;&lt; &quot;Test #&quot; &lt;&lt; i+1 &lt;&lt; &quot;: Non-symmetric.\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge E513\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u984c\uff1aUVa 11349 &#8211; Symmetric Matrix \u73fe\u5728\u7d66\u4f60\u4e00\u500b\u6b63\u65b9\u5f62\u77e9\u9663 M\u3002M \u77e9 [&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":[18],"tags":[15,20,8,9],"class_list":["post-443","post","type-post","status-publish","format-standard","hentry","category-uva","tag-long-long-int","tag-20","tag-8","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/comments?post=443"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/443\/revisions"}],"predecessor-version":[{"id":444,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/443\/revisions\/444"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}