← All problemsSign in

Circle Coloring

CodeChefRating 3104Open on judge ↗

You are given $N$ sets of integers $A_1, A_2, \ldots, A_N$. For each valid $i$, let's denote the elements of the set $A_i$ by $\{c_{i,1}, c_{i,2}, \ldots, c_{i,|A_i|}\}$. Find the number of ways to choose a sequence $(a_1, a_2, \ldots, a_N)$ such that: - $a_i \in A_i$ for each valid $i$ - $a_i \neq a_{i+1}$ for each valid $i$ and $a_1 \neq a_N$ Since this number may be large, compute it mo

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start