Question: code pls Rahaf the magician was making a new magical armor. She went to the Twilight city to get some magical points for her armor.

 code pls Rahaf the magician was making a new magical armor.

She went to the Twilight city to get some magical points for

her armor. The Twilight city has N + 1 magical houses indexed

code pls

Rahaf the magician was making a new magical armor. She went to the Twilight city to get some magical points for her armor. The Twilight city has N + 1 magical houses indexed from 1 to N + 1. At each house from 1 to N there's a fairy that will give Rahaf A[i] (1 sis N) magical points. It is given that A[i] might be negative which means that the fairy took some magical points from Rahaf. Additionally at each house from 1 to N there's a teleporter with power p[i] (1 sis N) that Rahaf can use to go from the house at index i to any house with an index from i+ 1 to i + p[i]. At first Rahaf is in the first house and she wants to go the (N + 1)th house with the maximum number of magical points she can get. Your task is to find the total number of ways to go from the first house to the (N + 1)th with the maximum number of magical points. Since the answer might be very large, you need to return it modulo 10^9+7. Your task is to find the total number of ways to go from the first house to the (N + 1)" with the maximum number of magical points. Since the answer might be very large, you need to return it modulo 10^9+7. Note: . It is given that the number of magical points might be negative which means that Rahaf lost magical points. ho Input Format The first line contains an integer, N, denoting the number of elements in A. Each line i of the N subsequent lines (where 0 si 2 - 3 -> 41 -> 3 -> 41 -> 4 Each with 0 magical points 3 2 -> The ways are 1 -> 2 -> 3 -> 4 -> 5 1 -> 4 -> 5 Each with 7 magical points. - MTN- 4 4 1 The road is 1 -> 4 -> 5 With 7 magical points 3 1 Rahaf the magician was making a new magical armor. She went to the Twilight city to get some magical points for her armor. The Twilight city has N + 1 magical houses indexed from 1 to N + 1. At each house from 1 to N there's a fairy that will give Rahaf A[i] (1 sis N) magical points. It is given that A[i] might be negative which means that the fairy took some magical points from Rahaf. Additionally at each house from 1 to N there's a teleporter with power p[i] (1 sis N) that Rahaf can use to go from the house at index i to any house with an index from i+ 1 to i + p[i]. At first Rahaf is in the first house and she wants to go the (N + 1)th house with the maximum number of magical points she can get. Your task is to find the total number of ways to go from the first house to the (N + 1)th with the maximum number of magical points. Since the answer might be very large, you need to return it modulo 10^9+7. Your task is to find the total number of ways to go from the first house to the (N + 1)" with the maximum number of magical points. Since the answer might be very large, you need to return it modulo 10^9+7. Note: . It is given that the number of magical points might be negative which means that Rahaf lost magical points. ho Input Format The first line contains an integer, N, denoting the number of elements in A. Each line i of the N subsequent lines (where 0 si 2 - 3 -> 41 -> 3 -> 41 -> 4 Each with 0 magical points 3 2 -> The ways are 1 -> 2 -> 3 -> 4 -> 5 1 -> 4 -> 5 Each with 7 magical points. - MTN- 4 4 1 The road is 1 -> 4 -> 5 With 7 magical points 3 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!