# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1232304 | emptypringlescan | Mensza (COI22_mensza) | C++17 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){=
int l;
cin >> l;
int q;
cin >> q;
while(q--){
string cmd;
cin >> cmd;
if(cmd[0]=='a'){
int x;
cin >> x;
cout << __builtin_popcount(x) << ' ';
x^=1<<19;
for(int i=18; i>=0; i--){
int yey=x>>i;
if(yey&1) cout << (yey^1) << ' ';
}
cout << endl;
}
else if(cmd[0]=='b'){
int x;
cin >> x;
x^=1<<19;
cout << 20 << ' ';
for(int i=19; i>=0; i--){
int yey=x>>i;
cout << yey << ' ';
}
cout << endl;
}
else{
int n;
cin >> n;
int x;
for(int i=0; i<n; i++){
cin >> x;
}
if(x==1) cout << "B" << endl;
else cout << "A" << endl;
}
}
}