Comments

Where did the [3,2,3,4,3] array come from in the first test case example on https://mirror.codeforces.com/contest/1894/problem/C ?

0

Spent too long trying to work out a solution under the wrong assumption. The first value of each following n lines in problem B is not actually an element of S. Ahh.

Oh, thanks for the help man! Your explanation made it very clear!

How do you get to 36 on problem C test#2#78? (--101111-- 11000 thanks for clearing it up puffinmuffin) My solution gives ans=1(group)!*4! = 24