Logo
(追記) (追記ここまで)

25436번 - Team Contest 서브태스크다국어언어 제한함수 구현

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB91252225.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);
  • $N$: the number of programmers.
  • $K$: the skill level limit of the registered teams.
  • $L$: an array of length $N$ describing the skill level of the programmers.
  • This procedure should return the maximum number of teams you can register.
  • This procedure is called exactly once.

예제

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ドル ≤ N ≤ 100,000円$
  • $ 1 ≤ K ≤ 10$
  • $ 1 ≤ L[i] ≤ 10$ (for each $i$ such that 0ドル ≤ i ≤ N - 1$)

서브태스크

번호배점제한
16

$N ≤ 3$

212

$N ≤ 8$

337

$N ≤ 1000$

445

No additional constraints.

힌트

샘플 그레이더

The sample grader reads the input in the following format:

  • line 1ドル$: $N$ $K$
  • line 2ドル$: $L[0]$ $L[1]$ $\dots$ $L[N - 1]$

The sample grader prints your answer in the following format:

  • line 1ドル$: the return value of maximum_teams

첨부

출처

Olympiad > International Olympiad in Informatics > IOI 2022 > Practice 3번

제출할 수 있는 언어

C++17, C++20, C++17 (Clang), C++20 (Clang)

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /