#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2701 ms |
2828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4918 ms |
139560 KB |
Output is correct |