应该先去看看这题的,补题的时候发现这题其实挺简单的。。
题意:n*m的格子用1-n*m的数去填,要求如果一个格子(i1,j1)与另外一个格子(i2,j2)满足(i1^j1)>(i2^j2),则a[i1][j1]>a[i2][j2]。问有多少种方法。
思路:n和m都在1000以内,我们可以预处理所有的格子的异或值。我们发现只有异或值大小不同的格子上的数有大小要求,而如果异或值相同的格子他们的大小关系是任意的,所以我们把所有异或值相同的数目求出来然后乘以其阶乘即可。
//#pragma comment(linker, "/STACK:102400000,102400000")#include