原题:
WZB's Harem
1000ms 131072K
描述:
Do you remember N-queens? Today, WZB accompanied his n queens to the cinema……
As the saying goes: Three queens for a play, one harem admits of no two queens…
Cinema uses n rows of seats, each row has n columns.Queens are grumpy, they're not willing to sit in the same row or same column with other queen, if there are two queens in the same row or same column they conflict occurs, so they make WZB arrange seats for them. It stumped WZB to avoid the queen make antinomy. WZB wants to know how many different arrangements there are for the queen, he'd like to choose one for them.
Since WZB and his queens arrived late, some seats had already been reserved by others. Although WZB is a king, he can't infringe on the rights of citizens, so the reserved seats could not be reserved for queens.
Now WZB has ordered you to work out how many ways to arrange the queen. If WZB finds out your calculations are wrong....
输入:
There is an integer n(n<=20)n(n<=20) in the firstline. The cinema has n rows and n columns of seats.
In the next lines,there are n integers ineach line(0 or 1).If the point(i,j)(i,j) is 11, it means it has been booked.
输出:
One integer.You just need to print the answer Mod 10000000071000000007.
样例输入:
2 0 0 0 0
样例输出:
4
(链接:https://acs.jxnu.edu.cn/problem/ICPCJX2020L)
翻译:
WZB的女眷
你觉得N皇后问题吗?今天WZB带着他他的n个皇后去电影院······
电影院使用n排座位,每一排有n列。皇后脾气不好,她们与其他皇后不愿意坐在同一排或同一列,如果有两个皇后坐在同一排或同一列她们将发生冲突,所以她们让WZB帮她们安排座位。WZB要避免她们发生冲突。WZB想知道有多少种不同的安排,他想要为她们选择一种。因为WZB和皇后们迟到了,一些座位已经被别人占了。尽管WZB是国王,他也不能侵犯人民的利益,所以,被占了的座位不能让皇后坐。
现在WZB让你计算出有多少种安排皇后座位的方式。如果WZB发现你的计算结果是错的······
输入:
第一行有一个整数n(n<=20)。表示电影院有n排n列。接下来,每行有n个整数(0或1)。如果点(i,j)是1,就表示这个座位被预订了。
输出:
一个整数,你只需要输出答案模上1000000007。