At some point, Tanya was examining chart hypothesis. She is extremely curious, so the accompanying issue before long struck a chord. 
Locate the quantity of undirected unweighted associated basic charts with N vertices (numbered 1 through N) and M edges, with the end goal that for every I (2≤i≤N), the briefest way from vertex 1 to vertex I is special and its length is equivalent to Ai. As such, for every I (2≤i≤N), there ought to be actually one way with length Ai between vertices 1 and I, and there ought to be no ways with littler length between these vertices. 
Two charts with N vertices are unmistakable in the event that we can discover two vertices u and v with the end goal that there is an edge between these vertices in one diagram, however not in the other diagram. 
Since the appropriate response could be enormous, process it modulo 1,000,000,007 (109+7). 
The principal line of the info contains a solitary whole number T meaning the quantity of experiments. The depiction of T experiments follows. 
The primary line of each experiment contains two space-isolated numbers N and M. 
The subsequent line contains N−1 space-isolated whole numbers A2,A3,… ,AN. 
For each experiment, print a solitary line containing one whole number ― the quantity of charts modulo 109+7. 
1≤Ai≤N−1 for each legitimate I 
the entirety of N over all experiments doesn’t surpass 2⋅105 
the entirety of M over all experiments doesn’t surpass 2⋅105 
Subtask #1 (50 focuses): M=N−1 
Subtask #2 (50 focuses): unique imperatives 
Model Input 
4 3 
1 2 1 
4 6 
1 2 1 
3 2 
Model Output 
Model case 1: The two diagrams which fulfill all conditions are:

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

two + fifteen =