Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<algorithm>
- #include<vector>
- #include<list>
- using namespace std;
- void preprocess(int);
- int test_case,x,y,monsters,queries;
- int* health;
- int to_change;
- vector<list<int> > bits;
- int main()
- {
- cin>>test_case;
- while(test_case--)
- {
- cin>>monsters;
- health = new int[monsters];
- for(int i=0;i<monsters;i++)
- {
- cin>>health[i];
- preprocess(health[i]);
- }
- }
- }
- void preprocess(int val)
- {
- int a,this_bit,copy_of_health;
- cout<<"currently:"<<val<<endl;
- a=val,this_bit = 0,copy_of_health = a;
- while(a)
- {
- if(a&1==1)
- {
- cout<<"Working on val"<<endl;
- bits[this_bit].push_back(copy_of_health);
- cout<<"done upto this"<<endl;
- cout<<"This list size:"<<bits[this_bit].size()<<endl;
- cout<<"pushed"<<copy_of_health<<"successfully"<<"in bit position"<<this_bit<<endl;
- }
- this_bit++;
- a >>= 1;
- }
- }
Add Comment
Please, Sign In to add comment