Array And &
Time Limit: 2 sec
Memory Limit: 756 MB
Attempts: 254
Accuracy: 0.39%
Author: Shubham Garg
While Avengers are fighting among each other, Thanos is trying to collect all infinity stones. In his quest, he got some encrypted information about the locations of infinity stones. For each possible location of an Infinity stone, he is given an integer array A of size n and decryption key is the number of subarrays [i,j] for which following condition is true:
(A[i] & A[i+1] &...A[j]) = min(A[i],A[i+1],....,A[j])
Since Thanos is busy planning to destroy the Avengers, he wants you to find the decryption key for him.
Input
First line contains t: No. of possible locations of stones.
First line of each possible location contains n: size of array A.
Next line contains n integers A[i].
Output
For each possible location output decryption key in new line.
Constraints
1 <= t <= 10
1 <= n <= 2*105
1 <= A[i] <= 109
Sample Input:
1
3
1 2 3
Sample Output
4
ID
SUBMITTED AT
STATUS
LANGUAGE
TIME
MEMORY USED
USER
TIME
STATUS
LANGUAGE
TIME
MEMORY USED
11 months ago
cpp14
2.01 sec
18808 KB
11 months ago
cpp14
2.00 sec
19600 KB
11 months ago
cpp14
0.00 sec
0 KB
11 months ago
cpp14
0.00 sec
0 KB
11 months ago
cpp14
0.07 sec
64 KB
11 months ago
cpp14
2.01 sec
17872 KB
11 months ago
cpp14
2.01 sec
24472 KB
11 months ago
cpp14
0.07 sec
64 KB
1 year ago
cpp
0.00 sec
0 KB
1 year ago
cpp
0.00 sec
0 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp14
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.38 sec
6024 KB
2 years ago
cpp14
0.00 sec
0 KB
2 years ago
cpp14
0.00 sec
0 KB
2 years ago
cpp
0.00 sec
0 KB
2 years ago
cpp
0.00 sec
0 KB
2 years ago
cpp
0.00 sec
0 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB
2 years ago
cpp
0.07 sec
64 KB