QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 64 MB Total points: 100

#18087. IQ

Statistics

$2n$명의 신입생이 프로그래밍 연습에 참여했습니다. 각 학생은 자신의 IQ 수준인 $a_i$를 가지고 있습니다.

코치는 학생들을 두 명씩 한 팀으로 나누려고 합니다. 각 팀은 팀원들의 IQ 합으로 정의되는 팀 IQ를 가집니다. 예를 들어, 학생 $i$와 $j$로 팀이 구성되면 팀 IQ는 $a_i + a_j$입니다. 팀 IQ가 더 큰 팀이 더 강한 팀입니다.

코치의 생각에 따르면, 가장 강한 팀과 가장 약한 팀의 팀 IQ 차이가 작을수록 연습 효율이 높습니다. 가장 강한 팀과 가장 약한 팀의 팀 IQ 차이가 $A$가 되도록 팀을 구성할 수 있을 때, 가능한 최소값 $A$를 구하도록 도와주세요.

입력

첫 번째 줄에는 정수 $n$ ($1 \le n \le 100$)이 주어집니다.

두 번째 줄에는 $2n$개의 정수가 주어지며, $i$번째 정수는 $i$번째 학생의 IQ인 $a_i$ ($1 \le a_i \le 200$, $1 \le i \le 2n$)입니다.

출력

팀을 구성할 수 있는 경우, 가장 강한 팀과 가장 약한 팀의 팀 IQ 차이의 최소값 $A$를 출력합니다.

예제

입력 1

3
100 100 89 140 102 150

출력 1

38

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.