Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream f("order.in");
- ofstream g("order.out");
- int q,c,n,s,x,st[100],top,cnt;
- long long sol;
- int main()
- {
- f>>q;
- while(q--)
- {
- f>>c;
- if(c==1)
- {
- for(f>>n,sol=0,s=0;n;--n)
- f>>x,s+=x,sol<<=x,--x,sol|=((1LL<<x)-1);
- sol|=(1LL<<(--s));
- g<<sol<<'\n';
- }
- else
- {
- f>>sol;
- top=0;
- while(sol)
- {
- ++top;
- while(sol%2)
- ++st[top],sol/=2;
- ++st[top];
- sol/=2;
- }
- --st[top];
- g<<top<<' ';
- for(;top;--top)
- g<<st[top]<<' ',st[top]=0;
- g<<'\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement