問題一覧 > 通常問題

No.794 Team Battle (2)

レベル : / 実行時間制限 : 1ケース 1.500秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 115
作問者 : ei1333333 / テスター : treeone
お気に入りにしたユーザー ProblemId : 2217 / 自分の提出
問題文最終更新日: 2019-03-26 21:17:58
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 206 (順位表) の他の問題:

Problem Statement

There are $N$ participants at the yukicoder contest onsite. The rating of the $i$-th person is $A_i$.

Everyone will now form teams, with $2$ people in $1$ team. However, the sum of the ratings of each team must be at most $K$. The same person cannot belong to multiple teams.

Find the number of ways to form such teams, modulo $10^9+7$.

Input

The input is given from standard input in the following format.

$N$ $K$
$A_1$ $A_2$ $...$ $A_N$
  • $2 \le N \le 2 \times 10^5$, $N$ is even
  • $1 \le K \le 2 \times 10^9$
  • $1 \le A_i \le 10^9$
  • All input values are integers

Output

Output, on $1$ line, the number of ways to form the teams, modulo $10^9+7$.

Sample

Sample 1
Input
4 6
2 3 1 4
Output
2

There are the following $2$ ways to form the teams.

  1. The $1$-st and $2$-nd people, the $3$-rd and $4$-th people
  2. The $1$-st and $4$-th people, the $2$-nd and $3$-rd people
Sample 2
Input
6 100
1 3 3 3 3 3
Output
15
Sample 3
Input
2 1
1 1
Output
0

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。