You have a weighted undirected complete graph of nodes numbered from to .
The weight of the edge between node and is defined as & (where & denotes bitwise AND operation).
Can you find the cost of the maximum spanning tree of this graph ?
First line of input consists of a single integer , the number of test cases.
Each test case consists of one line. First and only line of each test case contains , the number of nodes.
For each test case, print one integer — cost of the maximum spanning tree of the graph.
4 3 6 11 8
0 8 39 21
A complete graph is a simple undirected graph in which every pair of distinct vertices is connected by a unique edge.
0% Solution Ratio
Login to submit