#P3182. [HAOI2016] 放棋子
[HAOI2016] 放棋子
Description
Given an matrix. Each row contains exactly one obstacle; it is guaranteed that no two obstacles are in the same row or the same column. You need to place pieces on this matrix (you cannot place a piece on a cell with an obstacle) such that each row contains exactly one piece and each column contains exactly one piece. Find the number of valid arrangements.
Input Format
The first line contains an integer , followed by an matrix. . denotes no obstacle, and denotes an obstacle.
Output Format
A single integer, the number of valid arrangements.
2
0 1
1 0
1
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号