CF2057C.Trip to the Olympiad
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In the upcoming year, there will be many team olympiads, so the teachers of "T-generation" need to assemble a team of three pupils to participate in them. Any three pupils will show a worthy result in any team olympiad. But winning the olympiad is only half the battle; first, you need to get there...
Each pupil has an independence level, expressed as an integer. In "T-generation", there is exactly one student with each independence levels from l to r, inclusive. For a team of three pupils with independence levels a, b, and c, the value of their team independence is equal to (a⊕b)+(b⊕c)+(a⊕c), where ⊕ denotes the bitwise XOR operation.
Your task is to choose any trio of students with the maximum possible team independence.
在即将到来的一年中,将举行多场团体奥林匹克竞赛,因此“T-generation”学校的老师们需要组建一支由三名学生组成的队伍来参加这些比赛。任意三名学生组成的队伍在任何团体奥林匹克竞赛中都能取得优异的成绩。但赢得竞赛仅是成功的一半;首先,你得先抵达赛场……
每名学生都有一个独立性水平,用一个整数表示。“T-generation”学校中,恰好有且仅有一名学生的独立性水平为 l 到 r(含端点)之间的每一个整数值。对于独立性水平分别为 a、b 和 c 的三名学生组成的队伍,其团队独立性值定义为 (a⊕b)+(b⊕c)+(a⊕c),其中 ⊕ 表示按位异或运算。
你的任务是:从所有可能的三人组合中,任选一组使得其团队独立性值达到最大可能值。
输入格式
Each test contains multiple test cases. The first line contains a single integer t (1≤t≤104) — the number of test cases. The description of the test cases follows.
The first line of each test case set contains two integers l and r (0≤l,r<230, r−l>1) — the minimum and maximum independence levels of the students.
每个测试包含多个测试用例。第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。随后是测试用例的描述。
每个测试用例的第一行包含两个整数 l 和 r(0≤l,r<230,且 r−l>1)—— 学生的最低和最高独立性水平。
输出格式
For each test case set, output three pairwise distinct integers a,b, and c, such that l≤a,b,c≤r and the value of the expression (a⊕b)+(b⊕c)+(a⊕c) is maximized. If there are multiple triples with the maximum value, any of them can be output.
对于每组测试用例,输出三个互不相同的整数 a、b 和 c,满足 l≤a,b,c≤r,并使得表达式 (a⊕b)+(b⊕c)+(a⊕c) 的值最大化。若存在多个达到最大值的三元组,输出任意一个即可。
输入输出样例
输入#1
8 0 2 0 8 1 3 6 22 128 137 69 98 115 127 0 1073741823
输出#1
1 2 0 8 7 1 2 1 3 7 16 11 134 132 137 98 85 76 123 121 118 965321865 375544086 12551794
说明/提示
In the first test case, the only suitable triplet of numbers (a,b,c) (up to permutation) is (0,1,2).
In the second test case, one of the suitable triplets is (8,7,1), where (8⊕7)+(7⊕1)+(8⊕1)=15+6+9=30. It can be shown that 30 is the maximum possible value of (a⊕b)+(b⊕c)+(a⊕c) for 0≤a,b,c≤8.
在第一个测试用例中,唯一满足条件的三元组数字(不考虑排列顺序)为 (0,1,2)。
在第二个测试用例中,一个满足条件的三元组是 (8,7,1),其中 (8⊕7)+(7⊕1)+(8⊕1)=15+6+9=30。可以证明:当 0≤a,b,c≤8 时,(a⊕b)+(b⊕c)+(a⊕c) 的最大可能值为 30。
输入解题思路,AI测评打分。不知道怎么写?