loj6728 U 群把妹王
The most important part is the PIE coefficient.
with out loss of generality, consider the case of 1 dimension.
denote p:n p∈ partitions of the set [n], ∣pi∣ the size of the i-th part and ∣p:n∣ the number of parts.
f(n) the fake answer(with something counted more than once). g(n) the genuine answer. d(n) the answer that all the part are distinct.
c(n) the PIE coefficient.
f(n)=i∑d(i)∑[∣p:n∣=i]
g(n)=i∑d(i)∣p:n∣=i∑j∏[∣pj∣∈S]
if we choose c(n) that satisfy
p:n∑(j∏c(∣pj∣))=[n∈S]
simplify g(n)
g(n)=i∑d(i)∣p:n∣=i∑j∏q:∣pj∣∑k∏c(∣qk∣)
=i∑d(i)q:n∑{∣q:n∣i}k∏c(∣qk∣)
=j∑∣q:n∣=j∑k∏c(qk)i∑{ji}d(i)
=j∑∣q:n∣=j∑k∏c(qk)f(j)
this is equivalent to first get c by
exp(k∑k!c(k)xk)=1+k∈S∑k!xk
then calculate
j∑f(j)(k∑k!c(k)xk)jj!1[xn]n!