P7087 [NWRRC 2013] Intellectual Property

题目描述

Erast Kopi is famous Sudoku puzzle designer. Resounding success of his puzzle compilations caused a number of imitations and plagiarisms. Prior to sending a lawsuit he decided to get more evidence. Sudoku puzzle is a table $9 \times 9$ , divided into $3 \times 3$ subtables of $3 \times 3$ cells each. Each cell may contain a digit from $1$ to $9$ . The task is to fill empty cells with digits in a way that each row, each column and each of the $9$ subtables $3 \times 3$ contains each digit from $1$ to $9$ exactly once. Kopi has a database of Sudoku puzzles and he wants to check if it contains similar puzzles. The puzzle $P$ is similar to the puzzle $Q$ , if it is possible to transform the puzzle $P$ into the puzzle $Q$ using a sequence of the following operations: choose two digits $x$ and $y$ and replace all digits $x$ with $y$ and vice versa; swap two triples of rows: $(1 , 2 , 3) , (4 , 5 , 6) , (7 , 8 , 9)$ ; swap two rows in one triple of rows; swap two triples of columns: $(1 , 2 , 3) , (4 , 5 , 6) , (7 , 8 , 9)$ ; swap two columns in one triple of columns; flip along top-left -- bottom-right axis. After this operation columns become rows and vice versa. ![](/upload/images2/ip.png) Help Kopi to find similar puzzles in his database.

输入格式

输出格式

说明/提示

Time limit: 2 s, Memory limit: 256 MB.