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>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
string s;
inline int encode(int a, int b, int c, int d){
return (a<<8) + (b<<2) + (c<<1) + d;
}
void solve(){
cin >> s;
if(s[0]=='c'){
int m, a; cin >> m;
forn(i, m) cin >> a;
cout << (a==1? 'B' : 'A') << endl;
}
else{
int num; cin >> num;
string ret("19");
forn(i, 19){
int dig = !(num & (1<<i));
ret.append(" ");
ret.append(to_string(encode(num&((1<<24) - (1<<(i+1))), i, dig^(s[0]=='a'), dig|(s[0]=='a'))));
}
cout << ret << endl;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, t; cin >> a >> t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |