Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- #include <algorithm>
- #include <queue>
- #include <map>
- #include <set>
- #include <bitset>
- #include <algorithm>
- using namespace std;
- typedef long long ll;
- int main() {
- int t;
- cin >> t;
- while(t--){
- int n;
- int ans = 0;
- cin >> n;
- priority_queue<int> a;
- map<int, bool> m;
- for(int i = 0; i < n; ++i){
- int x;
- cin >> x;
- if(!m[x]){
- a.push(x);
- }
- m[x] = true;
- }
- while(a.size() > 0){
- int x = a.top();
- a.pop();
- if(x % 2 == 1){
- continue;
- }
- else{
- if(!m[x / 2])
- a.push(x / 2);
- ++ans;
- }
- }
- cout << ans << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement