← All problemsSign in

Path-etic Sums

CodeChefRating 1838Open on judge ↗

You are given a tree with $N$ nodes (numbered $1$ through $N$). A tree is a connected undirected graph without cycles. You have to assign an integer to each node; for each valid $i$, let's denote the integer assigned to node $i$ by $A_i$. This assignment must satisfy the following conditions: - For each valid $i$, $1 \le A_i \le 10^5$. - For each simple path in the tree which contains at least tw

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