#K36122. Minimum Number of Teams
Minimum Number of Teams
Minimum Number of Teams
You are given N employees, each with a certain skill level. You need to form teams to accommodate all employees with the following constraint: each team can contain at most two employees, and the sum of their skills must not exceed a given capacity C. Formally, if an employee with skill s_i is paired with an employee with skill s_j, the pairing is valid only if \( s_i + s_j \le C \). If an employee cannot be paired with another, they must form a team on their own.
Your task is to compute the minimum number of teams required to accommodate all employees under this constraint.
Input Constraints:
- \(1 \le N \le 10^5\)
- \(1 \le C \le 10^9\)
- \(1 \le s_i \le C\) for each skill
Example:
Input: 5 10 6 3 5 8 2</p>Output: 3
inputFormat
The first line of input contains two integers N and C, where N is the number of employees and C is the maximum allowed capacity per team. The second line contains N integers representing the skill levels of the employees.
outputFormat
Output a single integer representing the minimum number of teams required.
## sample5 10
6 3 5 8 2
3
</p>