{"id":315,"date":"2016-12-06T09:50:58","date_gmt":"2016-12-06T01:50:58","guid":{"rendered":"http:\/\/kylelv.com\/?p=315"},"modified":"2017-12-22T19:58:49","modified_gmt":"2017-12-22T11:58:49","slug":"bzoj-3517-%e7%bf%bb%e7%a1%ac%e5%b8%81","status":"publish","type":"post","link":"https:\/\/blog.kylelv.com\/?p=315","title":{"rendered":"bzoj 3517: \u7ffb\u786c\u5e01"},"content":{"rendered":"<p><center><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69fdef88ec42f\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69fdef88ec42f\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#3517_%E7%BF%BB%E7%A1%AC%E5%B8%81\" title=\"3517: \u7ffb\u786c\u5e01\">3517: \u7ffb\u786c\u5e01<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#Description\" title=\"Description\">Description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#Input\" title=\"Input\">Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#Output\" title=\"Output\">Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#Sample_Input\" title=\"Sample Input\">Sample Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#Sample_Output\" title=\"Sample Output\">Sample Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#HINT\" title=\"HINT\">HINT<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blog.kylelv.com\/?p=315\/#Source\" title=\"Source\">Source<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"3517_%E7%BF%BB%E7%A1%AC%E5%B8%81\"><\/span>3517: \u7ffb\u786c\u5e01<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span class=\"green\">Time Limit:\u00a01 Sec\u00a0\u00a0Memory Limit:\u00a0128 MB<\/span><\/center><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Description\"><\/span>Description<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<div>\u6709\u4e00\u4e2a<em>n<\/em>\u884c<em>n<\/em>\u5217\u7684\u68cb\u76d8\uff0c\u6bcf\u4e2a\u683c\u5b50\u4e0a\u90fd\u6709\u4e00\u4e2a\u786c\u5e01\uff0c\u4e14<em>n<\/em>\u4e3a\u5076\u6570\u3002\u6bcf\u4e2a\u786c\u5e01\u8981\u4e48\u662f\u6b63\u9762\u671d\u4e0a\uff0c\u8981\u4e48\u662f\u53cd\u9762\u671d\u4e0a\u3002\u6bcf\u6b21\u64cd\u4f5c\u4f60\u53ef\u4ee5\u9009\u5b9a\u4e00\u4e2a\u683c\u5b50(<em>x,y<\/em>)\uff0c\u7136\u540e\u5c06\u7b2c<em>x<\/em>\u884c\u548c\u7b2c<em>y<\/em>\u5217\u7684\u6240\u6709\u786c\u5e01\u90fd\u7ffb\u9762\u3002\u6c42\u5c06\u6240\u6709\u786c\u5e01\u90fd\u53d8\u6210\u540c\u4e00\u4e2a\u9762\u6700\u5c11\u9700\u8981\u7684\u64cd\u4f5c\u6570\u3002<\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Input\"><\/span>Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<div>\u7b2c\u4e00\u884c\u5305\u542b\u4e00\u4e2a\u6b63\u6574\u6570<em>n<\/em>\u3002<\/div>\n<div>\u63a5\u4e0b\u6765<em>n<\/em>\u884c\uff0c\u6bcf\u884c\u5305\u542b\u4e00\u4e2a\u957f\u5ea6\u4e3a<em>n<\/em>\u768401\u5b57\u7b26\u4e32\uff0c\u8868\u793a\u68cb\u76d8\u4e0a\u786c\u5e01\u7684\u72b6\u6001\u3002<\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Output\"><\/span>Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<div>\u4ec5\u5305\u542b\u4e00\u884c\uff0c\u4e3a\u6700\u5c11\u9700\u8981\u7684\u64cd\u4f5c\u6570\u3002<\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Input\"><\/span>Sample Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">4<br \/>\n0101<br \/>\n1000<br \/>\n0010<br \/>\n0101<br \/>\n<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Output\"><\/span>Sample Output<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\"><span class=\"sampledata\">2<br \/>\n<\/span><\/div>\n<h2><span class=\"ez-toc-section\" id=\"HINT\"><\/span>HINT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"content\">\n<p>&nbsp;<\/p>\n<p>\u3010\u6837\u4f8b\u8bf4\u660e\u3011<\/p>\n<p>\u5bf9(2,3)\u548c(3,1)\u8fdb\u884c\u64cd\u4f5c\uff0c\u6700\u540e\u5168\u53d8\u62101\u3002<\/p>\n<p>\u3010\u6570\u636e\u89c4\u6a21\u3011<\/p>\n<p>\u5bf9\u4e8e100%\u7684\u6570\u636e\uff0cn \u2264 1,000\u3002<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Source\"><\/span>Source<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:c++ decode:true \">#include&lt;cstdio&gt;\r\n#include&lt;algorithm&gt;\r\nusing namespace std;\r\n#define N 1010\r\nint ans,n;\r\nbool a[N][N],sum1[N],sum2[N];\r\nchar s[N];\r\nint main()\r\n{\r\n    scanf(\"%d\\n\",&amp;n);\r\n    for(int i=0;i&lt;n;i++)\r\n    {\r\n        gets(s);\r\n        for(int j=0;j&lt;n;j++)\r\n        {\r\n            a[i][j]=s[j]-'0';\r\n            sum1[i]^=a[i][j];\r\n            sum2[j]^=a[i][j];\r\n        }\r\n    }\r\n    for(int i=0;i&lt;n;i++) for(int j=0;j&lt;n;j++) ans+=sum1[i]^sum2[j]^a[i][j];\r\n    printf(\"%d\\n\",min(ans,n*n-ans));\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>3517: \u7ffb\u786c\u5e01 Time Limit:\u00a01 Sec\u00a0\u00a0Memory Limit:\u00a0128 MB Descr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[8],"class_list":["post-315","post","type-post","status-publish","format-standard","hentry","category-bzoj","tag-8"],"_links":{"self":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=315"}],"version-history":[{"count":1,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":316,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions\/316"}],"wp:attachment":[{"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kylelv.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}