Chef and Pairs | PAIRCNT | CODECHEF JULY CHALLENGE
Jul 2, 2021
You are given a tree (connected, undirected, acyclic graph) consisting of NN nodes. Based on this tree, you have to answer QQ queries.
Each query is of the form:
- K D V1 V2 ⋯ VKK D V1 V2 ⋯ VK — output the number of pairs (i,j)(i,j), 1≤i