[{"sectionTitle":"题目描述","type":"Text","text":"原题来自:USACO\r\n\r\n已知原数列 a1,a2,cdots,an 中的前 1 项,前 2 项,前 3 项, cdots ,前 n 项的和,以及后 1 项,后 2 项,后 3 项, cdots ,后 n 项的和,但是所有的数都被打乱了顺序。此外,我们还知道数列中的数存在于集合 S 中。试求原数列。当存在多组可能的数列时,求字典序最小的数列。","subType":"markdown"},{"sectionTitle":"输入格式","type":"Text","text":"第 1 行,一个整数 n 。 \r\n第 2 行, 2timesn 个整数,注意:数据已被打乱。 \r\n第 3 行,一个整数 m ,表示 S 集合的大小。 \r\n第 4 行, m 个整数,表示 S 集合中的元素。","subType":"markdown"},{"sectionTitle":"输出格式","type":"Text","text":"输出满足条件的最小数列。","subType":"markdown"},{"sectionTitle":"样例","type":"Sample","text":"","subType":"markdown","payload":["5\n1 2 5 7 7 9 12 13 14 14\n4\n1 2 4 5","1 1 5 2 5"]},{"sectionTitle":"数据范围与提示","type":"Text","text":"#### 数据范围\r\n对于 100 的数据, 1lenle1000,1lemle500 ,且 Sin1,2,cdots,500 。\r\n\r\n#### 样例解释\r\n\r\n| 从左往右求和 | 从右往左求和 | \r\n| :------------: | :------------: | \r\n| phantom01=1phantom+1+5+2+5 | phantom05=phantom1+1+5+2+5 | \r\n| phantom02=1+1phantom+5+2+5 | phantom07=phantom1+1+5+2+5 | \r\n| phantom07=1+1+5phantom+2+5 | 12=phantom1+1+5+2+5 | \r\n| phantom09=1+1+5+2phantom+5 | 13=phantom1+1+5+2+5 | \r\n| 14=1+1+5+2+5 | 14=1+1+5+2+5 | ","subType":"markdown"}]