NOI2025 寿司晚宴
Statement
Find number of 2 disjoint sets of \(\{2,\dots,n\}\) \(S\) and \(T\), such that \(\forall i,j: \gcd(S_i,T_j)=1\).
Step 1
We can record the set of prime factors of each set. That gives \(f[i,p_S,p_T]\). The number of states explode to \(O(n 4^{\frac{n}{\ln n}})\).
Step 2
For any number in \([2, n]\), there is at most \(1\) prime factor larger than \(\sqrt{n}\). We can only record the smaller prime factors.
Step 3 - Solution
But we still need to distinguish between the large prime factors. We can sort \([2,n]\) by their largest prime factor. For each large prime factor \(P\),