Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int t;
- cin>>t;
- while(t--)
- {
- int n;
- cin>>n;
- vector<long long int> a(n);
- for(auto &e: a)
- cin>>e;
- int maxBit = 0;
- for(auto e: a)
- {
- for(int b=0; b<61; b++)
- {
- if(((1ll<<b) & e) > 0)
- maxBit = max(maxBit, b);
- }
- }
- int cnt = 0;
- for(auto e: a)
- cnt += (((1ll<<maxBit) & e) > 0);
- cout<<(cnt + 1)/2<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment