B. Rock and Lever SOLUTION Codeforces Round #672 (Div. 2)

Rock and Lever SOLUTION

Danik earnestly needs rock and switch! Clearly, the most effortless approach to get these things is to approach Hermit Lizard for them. 
 
Recluse Lizard consented to give Danik the switch. In any case, to get a stone, Danik needs to unravel the accompanying undertaking. 
 
You are given a positive whole number n, and an exhibit an of positive numbers. The errand is to figure the quantity of such matches (i,j) that i<j and ai and aj≥ai⊕aj, where and signifies the bitwise AND activity, and ⊕ indicates the bitwise XOR activity. 
 
Danik has tackled this assignment. Be that as it may, would you be able to settle it? 
 
Information 
 
Each test contains various experiments. 
 
The principal line contains one certain whole number t (1≤t≤10) indicating the quantity of experiments. Portrayal of the experiments follows. 
 
The main line of each experiment contains one certain number n (1≤n≤105) — length of the exhibit. 
 
The subsequent line contains n positive whole numbers ai (1≤ai≤109) — components of the cluster. 
 
It is ensured that the aggregate of n over all experiments doesn’t surpass 105. 
 
Yield 
 
For each experiment print one non-negative number — the response to the issue. 
 
Model 
 
inputCopy 
 
 
 
1 4 3 7 10 
 
 
 
 
6 2 5 3 
 
 
2 4 
 
 
 
outputCopy 
 
 
 
 
 
 
Note 
 
In the main experiment there is just one sets: (4,7): for it 4 and 7=4, and 4⊕7=3. 
 
In the subsequent experiment all sets are acceptable. 
 
In the third experiment there are two sets: (5,6) and (2,3). 
 
In the fourth experiment there are nothing but bad matches.
 

Leave a Comment

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+