adplus-dvertising

We Are Discuss About CODECHEF SOLUTION

Air Blimp CodeChef Solution

Air Blimp CodeChef Solution

Problem

There are N cities in a row. The i-th city from the left has a sadness of A_i.

In an attempt to reduce the sadness of the cities, you can send blimps from the left of city 1 that move rightwards (i.e, a blimp crosses cities 1, 2, \ldots in order)

You are given two integers X and Y. For each blimp sent, you can make one of the following choices:

Next Week Assignment Answers

SciShowEngineerTelegram
  • Let the blimp fly over every city, in which case the sadness of¬†every city¬†will decrease by¬†Y, or,
  • Choose a city¬†i¬†(1 \leq i \leq N), and shower confetti over city¬†i. In this case, the sadness of cities¬†1, 2, \ldots, i-1¬†will decrease by¬†Y, the sadness of city¬†i¬†will decrease by¬†X, and cities¬†i+1, \ldots, N¬†see no change in sadness.

Find the minimum number of blimps needed such that, by making the above choice optimally for each blimp, you can ensure that no city is sad (i.e, in the end every city has sadness \leq 0).

 

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

 

Input Format

  • The first line of input contains a single integer¬†T¬†‚ÄĒ the number of test cases. Then the test cases follow.
  • The first line of each test case contains three space-separated integers¬†N, X, Y¬†‚ÄĒ the size of the array, and the parameters mentioned in the statement.
  • The second line of each test case contains¬†N¬†space-separated integers¬†A_1, A_2, \ldots, A_N, denoting the sadness of the¬†N¬†cities.

Output Format

For each test case, output on a new line the minimum number of blimps needed such that no city is sad.

Constraints

  • 1 \leq T \leq 10^4
  • 1 \leq N \leq 3\cdot10^5
  • 1 \leq X,Y \leq 10^9
  • 0 \leq A_i \leq 10^9
  • The sum of¬†N¬†over all test cases does not exceed¬†3\cdot10^5

Sample 1:

Input

Output

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

 

3
4 4 4
1 5 4 4
5 4 3
1 4 3 3 5
4 3 1
3 1 3 9
2
2
3

Explanation:

Test case 1: One way of using two blimps is as follows:

  • Initially,¬†A = [1, 5, 4, 4]
  • Shower confetti on city¬†2. Now,¬†A = [-3, 1, 4, 4].
  • Shower confetti on city¬†4. Now,¬†A = [-7, -3, 0, 0]¬†and we are done.

Test case 2: One way of using two blimps is as follows:

  • Initially,¬†A = [1, 4, 3, 3, 5]
  • Let a blimp fly over every city. Now,¬†A = [-2, 1, 0, 0, 2].
  • Shower confetti on city¬†5. Now,¬†A = [-5, -2, -3, -3, -2], and we are done.

SOLUTION

Air Blimp CodeChef Solution

SOLUTION

Air Blimp CodeChef Solution

SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE

Related Posts

Leave a Reply

Your email address will not be published.