QOJ.ac

QOJ

시간 제한: 1 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓

#13971. Dream Team

통계

Jiro Horikoshi

堀越二郎(Jiro Horikoshi)是一位年轻的飞机设计师,他正寻求组建一个航空工程师团队来帮助他设计他的第一架飞机。

他希望组建一支由 12 名工程师组成的梦之队。他可以从 $N$ 名工程师中进行选择,其中第 $i$ 名工程师的技术评级为 $a_i$,薪水为 $s_i$。为了促进和谐的团队环境,二郎希望所有团队成员的技术水平和薪水都相对均等。也就是说,技术差距(团队中最高与最低技术评级之差)不能超过 $P$,且薪水差距(团队中最高与最低薪水之差)不能超过 $Q$。

由于这是二郎的第一架飞机,他无法承担过高的花费,你能帮二郎组建一支满足要求且总花费(薪水之和)最少的工程师团队吗?

输入格式

输入的第一行包含三个空格分隔的整数 $N$($1 \le N \le 100$)、$P$($1 \le P \le 100$)和 $Q$($1 \le Q \le 10^8$),分别代表可供选择的工程师数量、最大技术差距和最大薪水差距。

下一行包含 $N$ 个整数 $a_1, a_2, \dots, a_N$($1 \le a_i \le 100$),其中每个 $a_i$ 代表第 $i$ 名工程师的技术评级。

最后一行包含 $N$ 个整数 $s_1, s_2, \dots, s_N$($1 \le s_i \le 10^8$),其中每个 $s_i$ 代表第 $i$ 名工程师的薪水。

输出格式

如果存在满足要求的团队,在第一行输出 "YES",并在第二行输出该最便宜团队的总花费。否则,仅在单行中输出 "NO"。

样例

输入样例 1

5 5 100
1 2 3 4 5
100 88 49 10000 666

输出样例 1

NO

输入样例 2

12 11 100
2 4 3 1 8 7 12 5 6 11 10 9
40 50 30 10 80 70 20 10 10 10 10 10

输出样例 2

YES
350

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.