QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 64 MB 总分: 100

#18087. IQ

统计

$2n$ 人の初心者の学生が競技プログラミングの練習にやってきました。各学生には IQ レベルがあり、$i$ 番目の学生の IQ は $a_i$ です。

コーチは学生を2人ずつのチームに分けたいと考えています。各チームには、チームメンバーの IQ レベルの合計に等しいチーム IQ が設定されます。例えば、学生 $i$ と学生 $j$ でチームが構成される場合、チーム IQ は $a_i + a_j$ となります。チーム IQ が大きいほど、そのチームは強いとみなされます。

コーチの考えでは、最も強いチームと最も弱いチームのチーム IQ の差が可能な限り小さいとき、練習は最も生産的になります。最も強いチームと最も弱いチームのチーム IQ の差が $A$ となるようにチームを構成できるような、最小の $A$ を求める手助けをしてください。

入力

1行目には整数 $n$ ($1 \le n \le 100$) が含まれます。

2行目には $2n$ 個の整数が含まれ、$i$ 番目の整数は $i$ 番目の学生の IQ $a_i$ ($1 \le a_i \le 200, 1 \le i \le 2n$) です。

出力

チームを構成できるような、最小の $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.