This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int maxlun,q;
void solve_a()
{
int a,suff=0;
cin>>a;
vector<int> v;
for(int i=18;i>=0;i--)
{
if(((1<<i)&a))
{
suff += (1<<i);
v.push_back(suff);
}
}
cout<<v.size()<<" ";
for(auto x:v) cout<<x<<" ";
cout<<"\n";
}
void solve_b()
{
int b,suff=0;
cin>>b;
vector<int> v;
for(int i=18;i>=0;i--)
{
if(((1<<i)&b))
{
suff += (1<<i);
}
else
{
v.push_back(suff+(1<<i));
}
}
cout<<v.size()<<" ";
for(auto x:v) cout<<x<<" ";
cout<<"\n";
}
void solve_c()
{
int lun,x;
cin>>lun;
for(int i=1;i<=lun;i++)
cin>>x;
if(x>1) cout<<"A\n";
else cout<<"B\n";
}
signed main()
{
cin>>maxlun>>q;
string tip;
while(q--)
{
cin>>tip;
if(tip=="alojzije")
{
solve_a();
}
else if(tip=="benjamin")
{
solve_b();
}
else
{
solve_c();
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |