{"problem":{"name":"[蓝桥杯 2024 国 A] 旋转九宫格","description":{"content":"给定一个 $3\\times 3$ 的九宫格，每个格子内分别含有一个数字，每个格子里的数字互不相同。每步我们可以选择任意一个 $2\\times 2$ 的区域将其顺时针旋转，例如： 例如 ```plain 1 2 3 4 5 6 7 8 9 ``` 将其旋转右上角，可得： ```plain 1 5 2 4 6 3 7 8 9 ``` 问最少需要几步才能将给定的状态旋转为 ```plain ","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":3000,"memory_limit":1048576},"difficulty":{"LuoguStyle":"P3"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP10578"},"statements":[{"statement_type":"Markdown","content":"给定一个 $3\\times 3$ 的九宫格，每个格子内分别含有一个数字，每个格子里的数字互不相同。每步我们可以选择任意一个 $2\\times 2$ 的区域将其顺时针旋转，例如：\n\n例如\n\n```plain\n1 2 3\n4 5 6\n7 8 9\n```\n\n将其旋转右上角，可得：\n\n```plain\n1 5 2\n4 6 3\n7 8 9\n```\n\n问最少需要几步才能将给定的状态旋转为\n\n```plain\n1 2 3\n4 5 6\n7 8 9\n```\n\n## Input\n\n输入的第一行包含一个整数 $T$ 表示询问的组数。\n\n接下来依次输入每组询问。\n\n每组询问包含三行，每行包含三个数，表示询问的九宫格的状态。\n\n## Output\n\n输出 $T$ 行，每行包含一个整数表示本次询问的答案。\n\n[samples]\n\n## Note\n\n对于 $60\\%$ 的评测用例，$T=1$;  \n对于所有评测用例，$T\\le 10^5$。","is_translate":false,"language":"English"}],"meta":{"iden":"LGP10578","tags":["搜索","2024","广度优先搜索 BFS","蓝桥杯国赛"],"sample_group":[["2\n1 2 3\n4 5 6\n7 8 9\n1 5 2\n4 6 3\n7 8 9","0\n3"]],"created_at":"2026-03-03 11:09:25"}}