{"problem":{"name":"[语言月赛 202406] 数组交换","description":{"content":"小 B 有一个 $n$ 行 $m$ 列的数组 $a$，现在它要操作 $q$ 次，每次的内容如下： - $\\textbf{1 x y}$，交换第 $x$ 行和第 $y$ 行，若 $x = y$ 则表示不交换。 - $\\textbf{2 x y}$，交换第 $x$ 列和第 $y$ 列，若 $x = y$ 则表示不交换。 - $\\textbf{3 x y}$，查询当前 $a_{x, y}$ 的值。 ","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P2"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGB3991"},"statements":[{"statement_type":"Markdown","content":"小 B 有一个 $n$ 行 $m$ 列的数组 $a$，现在它要操作 $q$ 次，每次的内容如下：\n\n- $\\textbf{1 x y}$，交换第 $x$ 行和第 $y$ 行，若 $x = y$ 则表示不交换。\n- $\\textbf{2 x y}$，交换第 $x$ 列和第 $y$ 列，若 $x = y$ 则表示不交换。\n- $\\textbf{3 x y}$，查询当前 $a_{x, y}$ 的值。\n\n对于每个操作 $3$，你需要回答。在所有操作结束后，你还需要输出最终的数组 $a$。你快告诉小 B 这些内容吧！\n\n## Input\n\n第 $1$ 行，输入 $3$ 个整数 $n,m,q$，以空格隔开。  \n第 $2 \\sim n + 1$ 行，每行输入 $m$ 个整数 $a_{i, j}$，没有空格。  \n第 $n + 2 \\sim n + q + 1$ 行，每行输入 $3$ 个整数，以空格隔开，表示一次询问。\n\n## Output\n\n设操作 $3$ 一共执行了 $w$ 次。  \n第 $1 \\sim w$ 行，每行输出一个整数，表示每次询问的答案。  \n第 $w + 1 \\sim w + n$ 行，每行输出 $m$ 个整数 $a_{i, j}$，没有空格，表示所有操作后的数组 $a$。\n\n[samples]\n\n## Note\n\n### 数据规模与约定\n\n对于 $20\\%$ 的数据，$1 \\leq n, m, q \\le 100$。  \n对于另外 $20\\%$ 的数据，没有操作 $1$。  \n对于另外 $20\\%$ 的数据，没有操作 $2$。  \n对于另外 $20\\%$ 的数据，没有操作 $3$。  \n对于 $100\\%$ 的数据，$1 \\leq n, m \\leq 10^3$，$1 \\leq q \\leq 10^5$，$0 \\leq a_{i, j} \\leq 9$。","is_translate":false,"language":"English"}],"meta":{"iden":"LGB3991","tags":["2024","O2优化","数组","语言月赛"],"sample_group":[["5 5 10\n01010\n10010\n01110\n00011\n00101\n1 2 4\n2 3 5\n3 2 3\n1 3 5\n2 1 4\n3 5 3\n1 4 5\n2 5 2\n2 3 4\n1 2 4\n","1\n0\n10001\n11001\n01010\n10010\n10100\n"]],"created_at":"2026-03-03 11:09:25"}}