F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Kanade's trio

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1778    Accepted Submission(s): 663


Problem Description
Give you an array $A[1..n]$£¬you need to calculate how many tuples $(i,j,k)$ satisfy that $(i<j<k)$ and $((A[i]~xor~A[j])<(A[j]~xor~A[k]))$

There are T test cases.

$1\leq T\leq 20$

$1\leq \sum n\leq 5*10^5$

$0\leq A[i] <2^{30}$
 

Input
There is only one integer T on first line.

For each test case , the first line consists of one integer $n$ ,and the second line consists of $n$ integers which means the array $A[1..n]$
 

Output
For each test case , output an integer , which means the answer.
 

Sample Input
1 5 1 2 3 4 5
 

Sample Output
6
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-25 19:54:12, Gzip enabled