SHARE
TWEET

Untitled

HoBoCTb Dec 14th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. #include <set>
  4. #include <map>
  5.  
  6. #pragma GCC optimize("Ofast")
  7. #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx")
  8. #pragma GCC optimization("O3")
  9. #pragma GCC optimization("unroll-loops")
  10.  
  11. typedef long long ll;
  12.  
  13. int main() {
  14.     ll t, n, curr;
  15.     scanf("%lld", &t);
  16.     for (int _ = 0; _ < t; ++_) {
  17.         scanf("%lld", &n);
  18.         ll ans = 0;
  19.         std::set<ll> a;
  20.         for (int i = 0; i < n; ++i) {
  21.             scanf("%lld", &curr);
  22.             if (curr % 2 == 0) { a.insert(curr); }
  23.         }
  24.         //printf("Here\n");
  25.         while (!a.empty()) {
  26.             curr = *a.rbegin();
  27.             a.erase(curr);
  28.             if (curr / 2 % 2 == 0) { a.insert(curr / 2); }
  29.             ++ans;
  30.             //printf("%lld\n", curr);
  31.         }
  32.         printf("%lld\n", ans);
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top