Movatterモバイル変換


[0]ホーム

URL:


Kattis logo

Kattis

Kattis Cat
Problems/ A Prize No One Can Win
Log in
View problem statement:A Prize No One Can Win
Hide

A Prize No One Can Win

After the festive opening of your new store, the Boutique store for Alternative Paramedicine and Cwakhsahlvereigh, to your disappointment you find out that you are not making as many sales as you had hoped. To remedy this, you decide to run a special offer: you will mark some subset of the$n$ items for sale in your store as participating in the offer, and if people buy exactly two of these items, and the cost of these items isstrictly more than$X$ euros, you will give them a free complimentary unicorn horn!

Since you recently found out all your unicorn horns are really narwhal tusks, you decide to rig the offer by picking the participating items in such a way that no one can earn a horn anyway.

To make sure no one becomes suspicious, you want to mark as many items as possible as participating in the offer.

Input

  • On the first line are two integers,$1 \leq n \leq 10^5$, the number of items for sale in your store, and$1\leq X \leq 10^9$, the minimum cost specified in the statement.

  • On the second line are$n$ positive integers, each at most$10^9$. These are the prices of the items in the store.

Output

Print the maximum number of items you can mark as part of your special offer, without anyone actually being able to receive a horn.

Sample Input 1Sample Output 1
5 61 2 3 4 5
3
Sample Input 2Sample Output 2
5 104 8 1 9 7
2
Sample Input 3Sample Output 3
4 101 3 1 7
4
Sample Input 4Sample Output 4
1 56
1

Please log in to submit a solution to this problem

Log in
CPU Time limit2 seconds
Memory limit1024 MB
3.2
DifficultyMedium

You haven't made any submissions on this problem yet.

Editor:

[8]ページ先頭

©2009-2025 Movatter.jp