## Input - The first line contains a single integer t denoting the number of test cases. The description of the t test cases follow one by one. - Each test case is described in 2 lines. The first line contains 4 space-separated integers n, d, h, and m, respectively. - The second line contains n space-separated integers, specifying the list l. ## Output For each test case, print "Yes" if Michael can qualify for the scholarship and "No" otherwise. Print these one per line, in the same order that the test cases appear in the input. ## Constraints - 1 <= t <= 5 - 1 <= n <= 1000 - 1 <= d <= 100 - 0 <= h <= 10**12 - 0 <= m <= 10**9 - 1 <= l[i] <= 10**9 ## Note The test cases for this question are designed such that any reasonable correct solution should get roughly 90%, regardless of how efficient it is. However, to get 100%, your code needs to be fairly efficient as well and finish running on any valid input (under the constraints above) within a few seconds. ## Sample Input ``` 3 3 3 2 50 25 62 20 5 8 3 60 11 61 9 33 29 2 1 2 50 49 51 ``` ## Sample Output ``` Yes Yes No ``` ## Sample Explanation - The first line of the input contains a single integer 3, indicating that there will be 3 test cases.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Q4: Getting the Grade


Michael is taking n courses this semester, numbered from 1 to n.
Each of these courses has a final exam. Unfortunately, these exams
are all held on the same day.

Michael has d days left to study for the exams. In each of these days,
he has exactly h hours of free time he can use to study (note that
h might be greater than 24 as Michael lives in a different universe with
a different time system).

Moreover, for the i-th course Michael is taking,
he has a learning rate l[i] indicating the number of marks he gets
on the exam per hour of studying for that course.
Michael studies for his exams in 1 hour blocks; for example,
he can't study for an exam for 40 minutes then switch to another one.

Note that in Michael's universe, final exam grades aren't
capped at 100. In fact, there's no upper limit on how high they can go.

If Michael takes an exam without studying for it, he'll get a 0 on that exam.

In order to qualify for a nice scholarship, Michael needs
to get at least m marks on each of the n exams. Help him out by telling
him whether it's possible to do so if he manages his time wisely.


## Input

- The first line contains a single integer t denoting the number of test cases.
The description of the t test cases follow one by one.
- Each test case is described in 2 lines. The first line contains
4 space-separated integers n, d, h, and m, respectively.
- The second line contains n space-separated integers, specifying the list l.


## Output

For each test case, print "Yes" if Michael can qualify
for the scholarship and "No" otherwise. Print these one per line, in the same order
that the test cases appear in the input.


## Constraints

- 1 <= t <= 5
- 1 <= n <= 1000
- 1 <= d <= 100
- 0 <= h <= 10**12
- 0 <= m <= 10**9
- 1 <= l[i] <= 10**9


## Note

The test cases for this question are designed such that any reasonable
correct solution should get roughly 90%, regardless of how
efficient it is.

However, to get 100%, your code needs to be fairly efficient as well
and finish running on any valid input (under the constraints above)
within a few seconds.

## Sample Input

```
3
3 3 2 50
25 62 20
5 8 3 60
11 61 9 33 29
2 1 2 50
49 51
```

## Sample Output

```
Yes
Yes
No
```

## Sample Explanation

- The first line of the input contains a single integer 3, indicating that
there will be 3 test cases.

- In the first test case, there are 3 courses. Michael has 3 days to study
for their exams. He has 2 free hours in each of those 3 days. Lastly,
he needs to get at least 50 marks in each of the exams to qualify for
the scholarship.
- The learning rates for the 3 exams are 25, 62, and 20.
- One way for Michael to get at least 50 marks in each exam is the following:
--- Study for course 3 one hour every day. He gets 20 marks an hour. That sums
up to 60 marks, which is greater than 50.
--- Study for course 2 one hour on the first day. He gets 62 marks, which is enough.
--- Study for course 1 one hour on days 2 and 3. He gets 50 marks, which is just enough.
"""

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

can you send an image of this code plz

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Parallel Processing
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY