CF730I.Olympiad in Programming and Sports
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are n students at Berland State University. Every student has two skills, each measured as a number: a__i — the programming skill and b__i — the sports skill.
It is announced that an Olympiad in programming and sports will be held soon. That's why Berland State University should choose two teams: one to take part in the programming track and one to take part in the sports track.
There should be exactly p students in the programming team and exactly s students in the sports team. A student can't be a member of both teams.
The university management considers that the strength of the university on the Olympiad is equal to the sum of two values: the programming team strength and the sports team strength. The strength of a team is the sum of skills of its members in the corresponding area, so the strength of the programming team is the sum of all a__i and the strength of the sports team is the sum of all b__i over corresponding team members.
Help Berland State University to compose two teams to maximize the total strength of the university on the Olympiad.
贝兰国立大学共有 n 名学生。每名学生拥有两项技能,均以数值表示:ai 表示编程技能,bi 表示体育技能。
据悉,不久将举办一场编程与体育奥林匹克竞赛。因此,贝兰国立大学需组建两支队伍:一支参加编程项目,另一支参加体育项目。
编程队必须恰好有 p 名学生,体育队必须恰好有 s 名学生。一名学生不能同时属于两支队伍。
校方认为,该校在本次奥林匹克竞赛中的整体实力等于两项之和:编程队实力与体育队实力。而一支队伍的实力定义为该队所有成员在对应领域技能值的总和;即编程队实力为所有入选队员的 ai 值之和,体育队实力为所有入选队员的 bi 值之和。
请帮助贝兰国立大学组建这两支队伍,使得该校在本次奥林匹克竞赛中的总实力最大化。
输入格式
The first line contains three positive integer numbers n, p and s (2 ≤ n ≤ 3000, p + s ≤ n) — the number of students, the size of the programming team and the size of the sports team.
The second line contains n positive integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 3000), where a__i is the programming skill of the i-th student.
The third line contains n positive integers _b_1, _b_2, ..., b__n (1 ≤ b__i ≤ 3000), where b__i is the sports skill of the i-th student.
第一行包含三个正整数 n、p 和 s(2 ≤ n ≤ 3000,p + s ≤ n)—— 分别表示学生人数、编程队规模和体育队规模。
第二行包含 n 个正整数 a1, a2, ..., an(1 ≤ ai ≤ 3000),其中 ai 表示第 i 位学生的编程能力。
第三行包含 n 个正整数 b1, b2, ..., bn(1 ≤ bi ≤ 3000),其中 bi 表示第 i 位学生的体育能力。
输出格式
In the first line, print the the maximum strength of the university on the Olympiad. In the second line, print p numbers — the members of the programming team. In the third line, print s numbers — the members of the sports team.
The students are numbered from 1 to n as they are given in the input. All numbers printed in the second and in the third lines should be distinct and can be printed in arbitrary order.
If there are multiple solutions, print any of them.
第一行输出大学在奥林匹克竞赛中的最大实力值。
第二行输出 p 个数字——编程队的队员编号。
第三行输出 s 个数字——体育队的队员编号。
学生按输入顺序从 1 到 n 编号。第二行和第三行中输出的所有数字必须互不相同,且可以以任意顺序输出。
若存在多种解法,输出任意一种即可。
输入输出样例
输入#1
5 2 2 1 3 4 5 2 5 3 2 1 4
输出#1
18 3 4 1 5
输入#2
4 2 2 10 8 8 3 10 7 9 4
输出#2
31 1 2 3 4
输入#3
5 3 1 5 2 5 1 7 6 3 1 6 3
输出#3
23 1 3 5 4
输入解题思路,AI测评打分。不知道怎么写?