← All problemsSign in

Markers on a Tree (Hard)

CodeChefRating 2194Open on judge ↗

**This is the hard version of the problem. Here you need to find the sum of $f(S)$ over all $2^N$ subsets $S$ modulo $998244353$.** For a tree $T$ consisting of $N$ labelled nodes, labelled $1$ through $N$; consider having $2$ markers, marker $A$ initially located at node $1$ and marker $B$ located at node $N$. In one move, you can move **exactly** one of the $2$ markers from it's current node

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