for _ in range(int(input())):
n=int(input())
c=[0]*99
for v in map(int,input().split()):
while v>n:v//=2
c[v]+=1
for i in range(n,0,-1):
if c[i]:
c[i//2]+=c[i]-1
else:
break
else:
print('YES')
continue
print('NO')
#include<bits/stdc++.h>
using namespace std;
int t,n,a[55],x;
int main(){
cin>>t;
while(t--){
cin>>n;
for(int i=0;i<=54;i++)
a[i]=0;
for(int i=1;i<=n;i++){
cin>>x;
while(x>n)
x=x/2;
while(a[x] and x>0)
x=x/2;
a[x]=1;
}
if(a[0])
cout<<"NO"<<endl;
else
cout<<"YES"<<endl;
}
return 0;
}
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |