QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 64 MB Puntuación total: 100

#18087. 智商

Estadísticas

有 $2n$ 位新生參加程式設計練習。每位學生都有一個 IQ 值:第 $i$ 位學生的 IQ 為 $a_i$。

教練想要將學生分成兩人一組的隊伍。每個隊伍的 IQ 定義為該隊成員的 IQ 之和。例如,如果一個隊伍由學生 $i$ 和 $j$ 組成,則該隊伍的 IQ 為 $a_i + a_j$。若一個隊伍的 IQ 大於另一個隊伍,則稱該隊伍較強。

教練認為,如果最強隊伍與最弱隊伍之間的 IQ 差值越小,練習的效果就越好。請協助教練找出一個最小值 $A$,使得我們可以將學生分組,並讓最強隊伍與最弱隊伍之間的 IQ 差值等於 $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.