fork download
  1. #include<bits/stdc++.h>
  2.  
  3. typedef long long int ll;
  4.  
  5. using namespace std;
  6.  
  7. #define MOD (ll)1000000007
  8.  
  9. ll arr[1000000];
  10.  
  11. int main(){
  12.  
  13. ll n;
  14. cin >> n;
  15. for(ll i = 0; i < n; i++){
  16. cin >> arr[i];
  17. }
  18. ll sum = 0;
  19. for(ll i = 0; i < 60; i++){
  20. ll oc = 0, zc = 0;
  21. for(ll j = 0; j < n; j++){
  22. if(arr[j]%2 == 0){
  23. zc++;
  24. }
  25. else{
  26. oc++;
  27. }
  28. arr[j] /= 2;
  29. }
  30. sum = (sum + (zc*oc*((ll)1<<i)%MOD)%MOD)%MOD;
  31. }
  32. cout << sum;
  33. }
Time limit exceeded #stdin #stdout 5s 4528KB
stdin
Standard input is empty
stdout
Standard output is empty