Ads
시간 제한3초메모리 제한2048 MB
영상 n개의 순서를 정해, 영상 3개마다 또는 마지막 광고로부터 k분이 지날 때마다 강제로 나오는 광고의 수를 최소화한다.
문제
You have videos on your watchlist on the popular platform YooCube. The -th video lasts minutes.
YooCube has recently increased the frequency of their ads. Ads are shown only between videos. After finishing a video, an ad is shown if either of these two conditions is true:
- three videos have been watched since the last ad;
- at least minutes have passed since the end of the last ad.
You want to watch the videos in your watchlist. Given that you have just watched an ad, and that you can choose the order of the videos, what is the minimum number of ads that you are forced to watch? You can start a new video immediately after the previous video or ad ends, and you don’t have to watch any ad after you finish.
입력
Each test contains multiple test cases. The first line contains an integer () — the number of test cases. The descriptions of the test cases follow.
The first line of each test case contains two integers and (, ) — the number of videos in your watchlist and the parameter that determines when ads are shown.
The second line contains integers () — the lengths of the videos.
The sum of the values of over all test cases does not exceed .
출력
For each test case, print the minimum number of ads that you need to watch.