CF1976C Job Interview
题目描述
### 题意翻译
Monocarp 要开设一家 IT 公司。他想招聘 $n$ 名程序员和 $m$ 名测试员。
共有 $n+m+1$ 名候选人,第 $i$ 个人的到达时间为 $i$。
第 $i$ 名候选人的编程技能为 $a_i$ ,测试技能为 $b_i$ (保证 $a_i\not=b_i$)。
公司的能力定义为所有程序员的编程能力与所有测试员的测试能力之和。
形式化的讲,若招聘的程序员集合为 $s$,测试员集合为 $t$,则公司的能力为 $\sum\limits_{i\in s}a_i+\sum\limits_{j\in t}b_j$。
Monocarp 会按照候选人到达的时间顺序为他们分配工作。
对于第 $i$ 个人,招聘规则为:
1. 尝试将 $i$ 分配到最适合 $i$ 的职位,也就是若 $a_i>b_i$,则让他成为程序员,反之同理。
2. 如果该职位已经招满了,就把 $i$ 分配到另一职位上。
你的任务是,对于每个 $i$,输出若这个人不来的情况下,公司的能力值。
输入格式
先是一个数字 $t$ 表示数据组数。
对于每组数据:
先输入两个数字 $n,m$ 表示要招聘的程序员/测试员数量。
接着 $n+m+1$ 个数表示每个人的编程能力。
再是 $n+m+1$ 个数表示每个人的测试能力。
输出格式
对于每组数据:输出 $n+m+1$ 个数,第 $i$ 个数表示去掉第 $i$ 个人时公司的能力值。
translate by Hoks。
说明/提示
Let's consider the third test case of the example:
- if the $ 1 $ -st candidate does not arrive, the $ 2 $ -nd candidate gets hired as a tester, the $ 3 $ -rd candidate gets hired as a programmer, the $ 4 $ -th candidate gets hired as a tester. The total skill of the team will be $ 2 + 5 + 1 = 8 $ ;
- if the $ 2 $ -nd candidate does not arrive, the $ 1 $ -st candidate gets hired as a tester, the $ 3 $ -rd candidate gets hired as a programmer, the $ 4 $ -th candidate gets hired as a tester. The total skill of the team will be $ 5 + 5 + 1 = 11 $ ;
- if the $ 3 $ -rd candidate does not arrive, the $ 1 $ -st candidate gets hired as a tester, the $ 2 $ -nd candidate gets hired as a tester, the $ 4 $ -th candidate gets hired as a programmer. The total skill of the team will be $ 5 + 2 + 4 = 11 $ ;
- if the $ 4 $ -th candidate does not arrive, the $ 1 $ -st candidate gets hired as a tester, the $ 2 $ -nd candidate gets hired as a tester, the $ 3 $ -rd candidate gets hired as a programmer. The total skill of the team will be $ 5 + 2 + 5 = 12 $ .