| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 91 | 25 | 22 | 25.287% |
You are a programming coach at a university. Your university is registering several teams to participate in a programming contest. The programming contest is participated by teams of three programmers.
In your university, there are $N$ eligible programmers, numbered from 0ドル$ to $N - 1$. For each $i$ such that 0ドル ≤ i ≤ N - 1,ドル programmer $i$ has a skill level of $L[i]$. The skill level of a team consisting of programmer $i,ドル $j,ドル and $k$ is $\min{(L[i],L[j],L[k])} + \max{(L[i],L[j],L[k])}$.
You want to only register teams with a skill level of strictly more than $K$. Each programmer may only be assigned to at most one registered team. You want to know the maximum number of teams you can register.
You should implement the following procedure:
int maximum_teams(int N, int K, int[] L);
Consider the following call:
maximum_teams(8, 6, [5, 4, 6, 2, 3, 2, 1, 1])
You can register a team with programmer 0ドル,ドル 3ドル,ドル and 5ドル$ (with skill levels 5ドル,ドル 2ドル,ドル 2ドル$ respectively) and a team with programmer 1ドル,ドル 2ドル,ドル and 4ドル$ (with skill levels 4ドル,ドル 6ドル,ドル 3ドル$ respectively). There is no way to register more than two teams. Therefore, the procedure maximum_teams should return 2ドル$.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 6 | $N ≤ 3$ |
| 2 | 12 | $N ≤ 8$ |
| 3 | 37 | $N ≤ 1000$ |
| 4 | 45 | No additional constraints. |
The sample grader reads the input in the following format:
The sample grader prints your answer in the following format:
maximum_teamsC++17, C++20, C++17 (Clang), C++20 (Clang)