{"id":715,"date":"2023-10-19T22:49:14","date_gmt":"2023-10-19T14:49:14","guid":{"rendered":"http:\/\/ggapa.net:81\/?p=715"},"modified":"2023-11-17T20:20:21","modified_gmt":"2023-11-17T12:20:21","slug":"csp-%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9%e3%80%81%e6%98%93%e9%94%99%e7%82%b9%e4%bb%a5%e5%8f%8a%e4%b8%80%e4%ba%9b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/ggapa.net:81\/2023\/10\/19\/csp-%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9%e3%80%81%e6%98%93%e9%94%99%e7%82%b9%e4%bb%a5%e5%8f%8a%e4%b8%80%e4%ba%9b%e6%96%b9%e6%b3%95\/","title":{"rendered":"OI \u6ce8\u610f\u4e8b\u9879\u3001\u6613\u9519\u70b9\u4ee5\u53ca\u4e00\u4e9b\u65b9\u6cd5"},"content":{"rendered":"
\u6309\u7167\u91cd\u8981\u6027\u9012\u51cf<\/p>\n
*\u9002\u7528\u4e8e\u56db\u5ddd<\/em><\/p>\n NOIP<\/p>\n \u8003\u8bd5\u7684\u65f6\u5019\u6837\u4f8b\u5f88\u591a\uff0c\u6211\u4eec\u53ef\u4ee5\u628a\u6240\u6709\u7684\u6837\u4f8b\u90fd\u590d\u5236\u5230 csp \u6587\u4ef6\u5939\u5185\uff0c\u7136\u540e\u68c0\u67e5\u7a0b\u5e8f\u7684\u65f6\u5019\u76f4\u63a5\u4fee\u6539\u6587\u4ef6\u64cd\u4f5c\u540d\u3002<\/p>\n \u4e3e\u4e2a\u4f8b\u5b50\u4e00\u9053\u9898\u76ee\u662f \u4fee\u6539\u4e3a<\/p>\n \u53ef\u89c1\u975e\u5e38\u7684\u65b9\u4fbf\uff0c\u4f60\u5c31\u4e0d\u7528\u6bcf\u8fd0\u884c\u4e00\u6b21\u5c31\u6253\u5f00\u4e00\u4e2a\u6587\u672c\u6587\u6863\u590d\u5236\u4e00\u4e0b\u518d\u6253\u5f00\u53e6\u4e00\u4e2a\u6587\u672c\u6587\u6863\u4e86\u3002\u76f4\u63a5\u4fee\u6539 \u8003\u8bd5\u7684\u65f6\u5019\u53ef\u80fd\u4f1a\u60f3\u51fa\u6765\u4e00\u4e9b\u5947\u5999\u7684\u70b9\u5b50\uff0c\u4f46\u662f\u60f3\u9a8c\u8bc1\u6b63\u786e\u6027\u600e\u4e48\u529e\u5462\uff1f\u8fd9\u65f6\u5019\u5bf9\u62cd\u5c31\u53d1\u6325\u7528\u5904\u4e86\u3002<\/p>\n \u5b8c\u6210\u5bf9\u62cd\u6211\u4eec\u9700\u8981 4 \u4e2a cpp \u6587\u4ef6\u4ed6\u4eec\u7684\u7528\u5904\u5206\u522b\u662f\uff1a<\/p>\n \u63a5\u7740\u6211\u4f1a\u901a\u8fc7\u4e00\u4e2a\u4f8b\u5b50\u6765\u8be6\u7ec6\u9610\u8ff0\u6bcf\u4e2a \u9898\u76ee\u63cf\u8ff0\uff1a\u8f93\u5165\u4e24\u4e2a\u6574\u6570\uff0c\u5176\u53d6\u503c\u8303\u56f4\u4e3a[0, 1e18]\uff0c\u6c42\u4ed6\u4eec\u7684\u548c\u3002<\/p>\n<\/blockquote>\n \u6211\u73b0\u5728\u5199\u4e86\u4e00\u4efd\u6211\u4e0d\u77e5\u9053\u6b63\u4e0d\u6b63\u786e\u7684\u7a0b\u5e8f\u3002<\/p>\n \u6211\u6709\u70b9\u4e0d\u592a\u653e\u5fc3\u4e8e\u662f\u6211\u51b3\u5b9a\u9a8c\u8bc1\u4e00\u4e0b\u3002\u5148\u5c06\u4ee3\u7801\u53e6\u5b58\u4e3a\u4e00\u4e0b\uff0c\u5e76\u4fee\u6539\u4e00\u4e0b\uff1a<\/p>\n \u8fd9\u6837\u5b50\u4ed6\u5c31\u80fd\u4ece \u63a5\u7740\u5199\u4e00\u4efd\u4f60\u8ba4\u4e3a\u5b8c\u5168\u6b63\u786e\u7684\u4ee3\u7801\u3002\u5e76\u5bf9\u4ed6\u6dfb\u52a0\u8f93\u5165\u8f93\u51fa\u91cd\u5b9a\u5411\u3002<\/p>\n \u63a5\u7740\u5f00\u59cb\u751f\u6210\u6570\u636e<\/p>\n \u6700\u91cd\u8981\u7684\u5730\u65b9\u6765\u4e86\uff0c\u6821\u5bf9\u5668\u3002\u6821\u5bf9\u5668\u4e3b\u8981\u5229\u7528\u4e86 Windows cmd \u4e2d\u7684 fc \u547d\u4ee4\uff0c\u53ef\u4ee5\u6bd4\u8f83\u4e24\u4e2a\u6587\u4ef6\u3002<\/p>\n \u5b8c\u6210\u4e86 4 \u4e2a cpp \u7684\u7f16\u5199\u4e4b\u540e\u5148\u628a\u4ed6\u4eec\u5168\u90e8\u90fd\u7f16\u8bd1<\/strong>\u4e00\u904d\uff0c\u4e00\u5b9a\u8981\u7f16\u8bd1\uff01\uff01\uff01<\/p>\n \u7136\u540e\u8fd0\u884ccheck.cpp\u3002\u7136\u540e\u5c31\u53ef\u4ee5\u53bb\u770b\u5176\u4ed6\u7684\u9898\u76ee\u4e86\uff0c\u65f6\u4e0d\u65f6\u7684\u770b\u4e00\u773c\u6709\u6ca1\u6709\u95ee\u9898\u3002<\/p>\n \u53ef\u4ee5\u770b\u5230\u4e00\u5f00\u59cb\u8f93\u51fa\u7684\u662f<\/p>\n \u8fd9\u4e2a\u4ee3\u8868\u7684\u6ca1\u6709\u95ee\u9898\uff0c\u82e5\u4f60\u8fd0\u884c\u4e86\u63a5\u8fd1 10 \u5206\u949f\u4f60\u7684\u7a0b\u5e8f\u4f9d\u7136\u6ca1\u6709\u505c\u6b62\uff0c\u90a3\u4e48\u5c31\u5927\u6982\u7387\u8bf4\u660e\u4f60\u60f3\u51fa\u6765\u7684\u505a\u6cd5\u662f\u53ef\u884c\u7684\u3002<\/p>\n \u82e5\u663e\u793a<\/p>\n \u8fd9\u5c31\u8bf4\u660e\u4f60\u7684\u4ee3\u7801\u786e\u786e\u5b9e\u5b9e\u5b58\u5728\u95ee\u9898\uff0c\u9700\u8981\u8c03\u6574\uff0c\u5177\u4f53\u7684\u95ee\u9898\u5df2\u7ecf\u88ab\u6307\u51fa\uff0c\u53ef\u67e5\u770b \u901a\u8fc7\u5206\u6790\uff0c\u6211\u4eec\u53d1\u73b0\u8f93\u51fa\u8d1f\u6570\u662f\u6ca1\u5f00 long long \u9020\u6210\u7684\uff0c\u53d1\u73b0\u95ee\u9898\u4e4b\u540e\u4fee\u6539\u4ee3\u7801\u5c31\u4e0d\u662f\u4e00\u4ef6\u5f88\u96be\u7684\u4e8b\u60c5\u4e86\u3002<\/p>\n \u5bf9\u62cd\u8fd8\u9002\u7528\u4e8e\u65e5\u5e38code\u4e2d\u7684debug\uff0c\u53ef\u4ee5\u590d\u5236\u4e00\u7bc7\u9898\u89e3\u6765\u5e2e\u52a9\u81ea\u5df1\u8c03\u8bd5<\/p>\n \u5e0c\u671b\u4ee5\u4e0a\u5185\u5bb9\u80fd\u591f\u5e2e\u52a9\u5230\u4f60\u3002<\/p>\n \u82e5\u4f60\u89c9\u5f97\u6709\u4ec0\u4e48\u5185\u5bb9\u4f60\u6ca1\u6709\u61c2\uff0c\u6216\u8005\u662f\u4e0d\u591f\u8be6\u7ec6\uff0c\u6709\u9057\u6f0f\u7b49\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728\u9875\u9762\u4e0b\u65b9\u8bc4\u8bba\u6216\u53d1\u90ae\u4ef6\u8054\u7cfb\u6211<\/p>\n \u795d\u5927\u5bb6\uff1a<\/p>\n $${\\Huge \\mathbf{{\\color{Red}CSP2023RP+=+\\infty } } } $$<\/p>\n","protected":false},"excerpt":{"rendered":" \u6309\u7167\u91cd\u8981\u6027\u9012\u51cf \u6ce8\u610f\u4e8b\u9879 *\u9002\u7528\u4e8e\u56db\u5ddd \u8003\u8bd5\u65f6\u8981\u5728 D \u76d8 csp \u76ee\u5f55\u4e0b\u4f5c\u7b54\uff0c\u4e0d\u80fd\u5efa\u7acb\u5b50\u6587\u4ef6\u5939\u3002 \u4ee3\u7801\u4e2d\u8bb0\u5f97 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/posts\/715"}],"collection":[{"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/comments?post=715"}],"version-history":[{"count":18,"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/posts\/715\/revisions"}],"predecessor-version":[{"id":946,"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/posts\/715\/revisions\/946"}],"wp:attachment":[{"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/media?parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/categories?post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ggapa.net:81\/wp-json\/wp\/v2\/tags?post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
freopen<\/code>\uff0c\u8003\u8bd5\u7ed3\u675f\u524d\u8bb0\u5f97\u5220\u6ce8\u91ca\u3002<\/li>\n
long long<\/code>\u3002<\/li>\n
long long<\/code> \u51fa\u73b0\u7684 MLE\uff0cTLE\u7b49\u95ee\u9898\u3002<\/li>\n
n<\/code>\u3001
m<\/code>\u4ee5\u53ca
i<\/code>\u3001
j<\/code>\u4e0d\u8981\u5199\u53cd\u3002<\/li>\n
cin<\/code>\u8981\u5173\u540c\u6b65\u3002<\/li>\n
cin<\/code> \u4e0d\u8981\u548c
printf<\/code> \u4e00\u8d77\u4f7f\u7528\u3002<\/li>\n
A += B; A % mod<\/code> \u7c7b\u4f3c\u7684\u4fee\u6539\u65b9\u6cd5\uff0c\u5e94\u8be5\u4f7f\u7528
A = (A + B) % mod;<\/code><\/li>\n
_<\/code> \u5f00\u5934\u7684\u51fd\u6570\uff0c\u6216\u8005\u662f\u6bd4\u8f83\u751f\u50fb\u7684\u51fd\u6570\u3002<\/li>\n
C++14<\/code>\u9700\u8981\u5728
dev<\/code>\u4e2d\u7684
\u7f16\u8bd1\u9009\u9879\u4e2d<\/code>\u52a0\u4e0a
-std=c++14<\/code><\/li>\n
\n\n
\u6280\u5de7<\/h1>\n
\u6d4b\u6837\u4f8b<\/h2>\n
AKIOI<\/code>\uff0c\u4ed6\u7684\u8f93\u5165\u662f
AKIOI.in<\/code>\uff0c\u5047\u5982\u826f\u5fc3 CCF \u7ed9\u4e86 10 \u4e2a\u6837\u4f8b\uff0c\u5c31\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n
freopen("AKIOI.in", "r", stdin);<\/code><\/pre>\n
freopen("AKIOI1.in", "r", stdin);\nfreopen("AKIOI2.in", "r", stdin);\nfreopen("AKIOI3.in", "r", stdin);\n......\nfreopen("AKIOI10.in", "r", stdin);<\/code><\/pre>\n
freopen()_<\/code>\u5185\u4e2d\u7684\u5185\u5bb9\u5373\u53ef\u3002<\/p>\n
\u5bf9\u62cd<\/h2>\n
\n
cpp<\/code> \u7684\u7528\u5904<\/p>\n
\n
#include <bits\/stdc++.h>\nusing namespace std;\n\nint main() {\n int a, b;\n cin >> a >> b;\n cout << a + b << endl;\n return 0;\n}<\/code><\/pre>\n
\/\/ Wrong.cpp\n#include <bits\/stdc++.h>\nusing namespace std;\n\nnamespace V {\n void Main() {\n \/\/\u5728\u8fd9\u4e2a\u91cc\u9762\u653e\u5165\u4f60\u9700\u8981\u9a8c\u8bc1\u7684\u7a0b\u5e8f\uff0c\u6211\u62ffa + b problem \u4e3e\u4f8b\u5b50\n int a, b;\n cin >> a >> b;\n cout << a + b << "\\n" ;\n }\n}\n\nint main() {\n freopen("test.in", "r", stdin);\n freopen("Wrong.out", "w", stdout);\n V::Main();\n return 0;\n}<\/code><\/pre>\n
test.in<\/code>\u4e2d\u8bfb\u5165\uff0c\u5728
Wrong.out<\/code>\u4e2d\u8f93\u51fa\u3002<\/p>\n
\/\/Answer.cpp\n#include <bits\/stdc++.h>\nusing namespace std;\n#define int long long \/\/\u5e94\u5f53\u4e00\u5f8b\u4f7f\u7528long long \u9632\u6b62\u4e00\u7cfb\u5217\u95ee\u9898\u7684\u4ea7\u751f\n\nnamespace STD {\n void Main() {\n \/*\u8fd9\u91cc\u5e94\u8be5\u653e\u4f60\u8ba4\u4e3a\u6b63\u786e\u7684\u4ee3\u7801*\/\n int a, b;\n cin >> a >> b;\n cout << a + b << "\\n" ;\n\n }\n}\n\nsigned main() {\n freopen("test.in", "r", stdin);\n freopen("std.out", "w", stdout);\n STD::Main();\n return 0;\n}<\/code><\/pre>\n
\/\/data.cpp\n#include <bits\/stdc++.h>\nusing namespace std;\n#define int long long \/\/\/\/\u5e94\u5f53\u4e00\u5f8b\u4f7f\u7528long long \u9632\u6b62\u4e00\u7cfb\u5217\u95ee\u9898\u7684\u4ea7\u751f\n\nint rnd(int x, int y) {\n return ((rand() * rand() * rand()) % y + x) % y; \/\/\u53ef\u7528\u4e8e\u751f\u6210\u6307\u5b9a\u8303\u56f4\u5185\u7684\u968f\u673a\u6570\n}\nvoid Start() {\n cout << rnd(1, 1e18) << " " << rnd(1, 1e18) << "\\n";\n}\nsigned main() {\n freopen("test.in", "w", stdout); \/\/\u5c06\u6570\u636e\u751f\u6210\u5230`test.in`\u4e2d\n srand(time(0)); \/\/\u968f\u673a\u6570\u79cd\u5b50\n Start();\n}<\/code><\/pre>\n
\/\/check.cpp\n#include<bits\/stdc++.h>\nusing namespace std;\nint main()\n{\n while (true) \n {\n \/\/system \u53ef\u4ee5\u8c03\u7528 Windows \u76f8\u5173\u7684\u6307\u4ee4\n system("data.exe"); \/\/\u5148\u8fd0\u884c\u6570\u636e\u751f\u6210\u5668\n system("Answer.exe"); \/\/\u8fd0\u884c\u4fdd\u8bc1\u6b63\u786e\u7684\u4ee3\u7801\n system("Wrong.exe"); \/\/\u8fd0\u884c\u5f85\u9a8c\u8bc1\u7684\u4ee3\u7801\n if (system("fc std.out Wrong.out")) { \/\/\u5f00\u59cb\u6bd4\u8f83\n system("pause"); \/\/\u5982\u679c\u6709\u5dee\u5f02\u5219\u6682\u505c\u7b49\u5f85\u64cd\u4f5c\uff0cpause \u5c31\u662f"\u6309\u4e0b\u4efb\u610f\u952e\u7ee7\u7eed"\u3002\n }\n }\n return 0;\n}<\/code><\/pre>\n
Comparing files std.out and WRONG.OUT\nFC: no differences encountered<\/code><\/pre>\n
Comparing files std.out and WRONG.OUT\n***** std.out\n2874271586\n***** WRONG.OUT\n-1420695710\n*****\n\nPress any key to continue . . .<\/code><\/pre>\n
test.in<\/code>\u3001
Wrong.out<\/code>\u3001
std.out<\/code>\u7684\u5185\u5bb9\uff0c\u6839\u636e\u8f93\u51fa\u6765\u5224\u65ad\u4ee3\u7801\u4e2d\u54ea\u91cc\u51fa\u73b0\u4e86\u95ee\u9898\u3002<\/p>\n
\n\u7ed3\u8bed<\/h1>\n