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<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int q,l;
cin>>l>>q;
while(q--){
string s;
cin>>s;
if(s[0]=='a'){
int n;
cin>>n;
n+=(1<<20);
vector<int> ans;
while(n>1){
if(n&1) ans.push_back(n);
n>>=1;
}
cout<<ans.size()<<" ";
for(auto x:ans) cout<<x<<" ";
cout<<"\n";
}
else if(s[0]=='b'){
int n;
cin>>n;
n+=(1<<20);
vector<int> ans;
while(n>1){
if(n%2==0) ans.push_back(n^1);
n>>=1;
}
cout<<ans.size()<<" ";
for(auto x:ans) cout<<x<<" ";
cout<<"\n";
}
else{
int n;
cin>>n;
vector<int> vec(n);
for(auto &x:vec) cin>>x;
bool flag=0;
for(auto x:vec){
if(x==2) flag=1;
}
if(flag) cout<<"A\n";
else cout<<"B\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |