因为考虑到某一列交换,则牵一发而动全身,会导致其他列不得不进行交换,这样的东西在图上本质就是环,我们把这样的环找出来。
比如说
1 2 3 5 4 2 3 1 4 5
这里我们发现有2个环,(1,2,3)和(4,5)
那么答案就是 2(环的个数)2^{(环的个数)}2(环的个数) , 这里不包括长度为1的环。
By signing up a 龙樾实验中学 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 龙樾实验中学 universal account