CF1618A.Polycarp and Sums of Subsequences
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarp had an array a of 3 positive integers. He wrote out the sums of all non-empty subsequences of this array, sorted them in non-decreasing order, and got an array b of 7 integers.
For example, if a=1,4,3, then Polycarp wrote out 1, 4, 3, 1+4=5, 1+3=4, 4+3=7, 1+4+3=8. After sorting, he got an array b=1,3,4,4,5,7,8.
Unfortunately, Polycarp lost the array a. He only has the array b left. Help him to restore the array a.
Polycarp 原本有一个由 3 个正整数组成的数组 a。他写出了该数组所有非空子序列的和,并将这些和按非递减顺序排序,从而得到了一个包含 7 个整数的数组 b。
例如,若 a={1,4,3},则 Polycarp 写出的数为:1、4、3、1+4=5、1+3=4、4+3=7、1+4+3=8。排序后,他得到数组 b={1,3,4,4,5,7,8}。
不幸的是,Polycarp 弄丢了数组 a,仅剩数组 b。请帮助他复原数组 a。
输入格式
The first line contains one integer t (1≤t≤5000) — the number of test cases.
Each test case consists of one line which contains 7 integers b1,b2,…,b7 (1≤bi≤109; bi≤bi+1).
Additional constraint on the input: there exists at least one array a which yields this array b as described in the statement.
第一行包含一个整数 t(1≤t≤5000)—— 测试用例的数量。
每个测试用例由一行组成,该行包含 7 个整数 b1,b2,…,b7(1≤bi≤109;bi≤bi+1)。
输入的附加约束:存在至少一个数组 a,能按题面描述的方式生成该数组 b。
输出格式
For each test case, print 3 integers — a1, a2 and a3. If there can be several answers, print any of them.
对于每个测试用例,输出 3 个整数 — a1、a2 和 a3。如果存在多个答案,输出其中任意一个即可。
输入输出样例
输入#1
5 1 3 4 4 5 7 8 1 2 3 4 5 6 7 300000000 300000000 300000000 600000000 600000000 600000000 900000000 1 1 2 999999998 999999999 999999999 1000000000 1 2 2 3 3 4 5
输出#1
1 4 3 4 1 2 300000000 300000000 300000000 999999998 1 1 1 2 2
说明/提示
The subsequence of the array a is a sequence that can be obtained from a by removing zero or more of its elements.
Two subsequences are considered different if index sets of elements included in them are different. That is, the values of the elements don't matter in the comparison of subsequences. In particular, any array of length 3 has exactly 7 different non-empty subsequences.
数组 a 的子序列是指通过从 a 中删除零个或多个元素后所得到的序列。
若两个子序列所包含元素的下标集合不同,则认为它们是不同的子序列。也就是说,在比较子序列时,元素的值无关紧要。特别地,任意长度为 3 的数组恰好有 7 个互不相同的非空子序列。
输入解题思路,AI测评打分。不知道怎么写?