Challenging Track
Practice
2.6 (5 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
43% Success 5040 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Alice and Bob saw a challenging track which consists of $$N$$ hurdles of variable heights $$H_i$$. Now, Bob challenges Alice to complete this track with a given amount of jump power $$P$$.

The rules for completing the challenge are as follows:

$$1$$. Each time Alice jumps a hurdle, jump power $$P$$ of Alice reduces by the height of the hurdle.

$$2$$. Every even minute all the remaining hurdles having even heights will decay and their heights reduce by $$1$$ and every odd minute all the remaining hurdles having odd heights will decay and their heights reduce by $$1$$.

Initially, time $$T = 0$$ minute. It takes $$1$$ minute for Alice to reach to the next hurdle and the time taken to jump a hurdle can be considered to be negligible. Alice has to complete the challenge starting from the first hurdle to the last hurdle, left to right, sequentially.

If $$P < 0$$ at any moment, Alice cannot move further. Find out if Alice can complete the challenge?

Input Format

The first line of the input contains $$T$$, the total number of test cases.

The second line of the input contains two space-separated integers $$N$$ and $$P$$, the total number of hurdles and the total jump power value.

The next line contains $$N$$ space-separated integers $$H_i$$, the heights of each hurdle.

Output Format

For each test case, if it is possible for Alice to complete the challenge, print $$Yes$$ and the remaining value of jump power $$P$$ or $$No$$ if it is not possible.

Constraints

\(1 \le T \le 10\)

\(1 \le N \le 10^5\)

\(1 \le P \le 10^{15}\)

\(1 \le H_i \le 10^9\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
45 votes
Tags:
Ad-HocApprovedEasyOpen
Points:20
38 votes
Tags:
Basic ProgrammingBasics of ImplementationCakewalkEasyImplementation
Points:20
72 votes
Tags:
ApprovedBasic ProgrammingEasy