{"problem":{"name":"[COTS 2024] 奇偶矩阵 Tablica","description":{"content":"考虑只包含 $0$ 和 $1$ 的 $N\\times M$ 矩阵 $A$。 我们称满足以下条件的矩阵是好的： - $\\forall 1\\le i\\le N$，$\\displaystyle \\sum_{j=1}^M A_{i,j}\\in \\{1,2\\}$； - $\\forall 1\\le j\\le M$，$\\displaystyle \\sum_{i=1}^N A_{i,j}\\in \\{1,2\\}","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":1048576},"difficulty":{"LuoguStyle":"P6"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP10681"},"statements":[{"statement_type":"Markdown","content":"考虑只包含 $0$ 和 $1$ 的 $N\\times M$ 矩阵 $A$。\n\n我们称满足以下条件的矩阵是好的：\n\n- $\\forall 1\\le i\\le N$，$\\displaystyle \\sum_{j=1}^M A_{i,j}\\in \\{1,2\\}$；\n- $\\forall 1\\le j\\le M$，$\\displaystyle \\sum_{i=1}^N A_{i,j}\\in \\{1,2\\}$。\n\n求出 $N$ 行 $M$ 列的好的矩阵的数量，对 $(10^9+7)$ 取模。\n\n## Input\n\n输入共一行两个正整数，即 $N,M$。\n\n## Output\n\n输出一行一个整数，表示答案对 $(10^9+7)$ 取模后的结果。\n\n[samples]\n\n## Background\n\n译自 [Izborne Pripreme 2024 (Croatian IOI/CEOI Team Selection)](https://hsin.hr/pripreme2024/) D1T2。$\\texttt{1s,1G}。$\n\n## Note\n\n#### 样例解释\n\n样例 $1$ 解释如图所示。\n\n![](https://cdn.luogu.com.cn/upload/image_hosting/xufx7ad6.png)\n\n#### 数据范围\n\n对于 $100\\%$ 的数据，$1\\le N,M\\le 3\\, 000$。\n\n| 子任务编号 | 分值 | 约束  |\n|:-----:|:------:|:-------:|\n| $1$  | $10$  | $N, M \\leq 6$   |\n| $2$  | $18$  | $N, M \\leq 50$  |\n| $3$  | $31$  | $N, M \\leq 200$ |\n| $4$  | $41$  | 无额外约束 |","is_translate":false,"language":"English"}],"meta":{"iden":"LGP10681","tags":["动态规划 DP","递推","2024","O2优化","生成函数","线性递推","COTS（克罗地亚）"],"sample_group":[["2 2","7"],["3 3","102"],["15 20","415131258"]],"created_at":"2026-03-03 11:09:25"}}