Guest User

Untitled

a guest
Jan 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<vector>
  4. #include<list>
  5. using namespace std;
  6. void preprocess(int);
  7. int test_case,x,y,monsters,queries;
  8. int* health;
  9. int to_change;
  10. vector<list<int> > bits;
  11. int main()
  12. {
  13. cin>>test_case;
  14. while(test_case--)
  15. {
  16. cin>>monsters;
  17. health = new int[monsters];
  18. for(int i=0;i<monsters;i++)
  19. {
  20. cin>>health[i];
  21. preprocess(health[i]);
  22. }
  23. }
  24. }
  25. void preprocess(int val)
  26. {
  27. int a,this_bit,copy_of_health;
  28. cout<<"currently:"<<val<<endl;
  29. a=val,this_bit = 0,copy_of_health = a;
  30. while(a)
  31. {
  32. if(a&1==1)
  33. {
  34. cout<<"Working on val"<<endl;
  35. bits[this_bit].push_back(copy_of_health);
  36. cout<<"done upto this"<<endl;
  37. cout<<"This list size:"<<bits[this_bit].size()<<endl;
  38. cout<<"pushed"<<copy_of_health<<"successfully"<<"in bit position"<<this_bit<<endl;
  39. }
  40. this_bit++;
  41. a >>= 1;
  42. }
  43. }
Add Comment
Please, Sign In to add comment