{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e吃豆子是一个有趣的游戏,每个人都拥有一个M*N矩阵,里面填满了不同品质的豆子。同时,每个1*1格子里只有一颗豆子。现在你想要吃掉豆子并收集品质,但是每个人必须遵守以下规则:如果你吃掉坐标为(x, y)的豆子,那么你不能吃掉坐标列表中的任何豆子(如果存在):(x, y-1), (x, y+1),以及横坐标为x-1和x+1的两行。\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/922a338e56da6967932e7906050c6ab9?v\u003d1715604758\"\u003e\u003c/center\u003e \u003cbr\u003e\u003cbr\u003e现在,你能吃掉并获得多少品质的豆子?\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"有几个测试用例。在每个测试用例中,有两个整数M(行数)和N(列数)。接下来的M行每行包含N个整数,表示豆子的品质。我们可以确保豆子的品质不会超过1000,且1≤M*N≤200000。"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,只需输出你能吃掉并获得的最大品质。"}},{"title":"样例","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 6\r\n11 0 7 5 13 9\r\n78 4 81 6 22 4\r\n1 40 9 34 16 10\r\n11 22 0 33 39 6\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e242\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}