CF1851F.Lisa and the Martians
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Lisa was kidnapped by martians! It okay, because she has watched a lot of TV shows about aliens, so she knows what awaits her. Let's call integer martian if it is a non-negative integer and strictly less than 2k , for example, when k=12 , the numbers 51 , 1960 , 0 are martian, and the numbers π , −1 , 821 , 4096 are not.
The aliens will give Lisa n martian numbers a1,a2,…,an . Then they will ask her to name any martian number x . After that, Lisa will select a pair of numbers ai,aj ( i=j ) in the given sequence and count (ai⊕x)&(aj⊕x) . The operation ⊕ means Bitwise exclusive OR, the operation & means Bitwise And. For example, (5⊕17)&(23⊕17)=(001012⊕100012)&(101112⊕100012)=101002&001102=001002=4 .
Lisa is sure that the higher the calculated value, the higher her chances of returning home. Help the girl choose such i,j,x that maximize the calculated value.
输入格式
The first line contains an integer t ( 1≤t≤104 ) — number of testcases.
Each testcase is described by two lines.
The first line contains integers n,k ( 2≤n≤2⋅105 , 1≤k≤30 ) — the length of the sequence of martian numbers and the value of k .
The second line contains n integers a1,a2,…,an ( 0≤ai<2k ) — a sequence of martian numbers.
It is guaranteed that the sum of n over all testcases does not exceed 2⋅105 .
输出格式
For each testcase, print three integers i,j,x ( 1≤i,j≤n , i=j , 0≤x<2k ). The value of (ai⊕x)&(aj⊕x) should be the maximum possible.
If there are several solutions, you can print any one.
输入输出样例
输入#1
10 5 4 3 9 1 4 13 3 1 1 0 1 6 12 144 1580 1024 100 9 13 4 3 7 3 0 4 3 2 0 0 1 2 4 12 2 9 4 6 14 9 4 4 4 5 10 2 2 1 1 0 2 4 11 4 9 4 2 11 10 1 6 9 11 0 5
输出#1
1 3 14 1 3 0 5 6 4082 2 3 7 1 2 3 1 2 15 4 5 11 1 2 0 1 2 0 2 7 4
说明/提示
First testcase: (3⊕14)&(1⊕14)=(00112⊕11102)&(00012⊕11102)=11012=11012&11112=11012=13 .
Second testcase: (1⊕0)&(1⊕0)=1 .
Third testcase: (9⊕4082)&(13⊕4082)=4091 .
Fourth testcase: (3⊕7)&(0⊕7)=4 .