#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define sp << " " <<
#define all(x) x.begin(),x.end()
#define big(x) ((int)(x.size()))
using namespace std;
const int MOD = 1e9+7, LIM = 1e6+1, inf = 2e9;
const int N = 1e5+1;
void solve() {
int L;
cin >> L;
int limbo = 18;
int q;
cin >> q;
while (q--) {
string s;
cin >> s;
assert(s == "alojzije" || s == "benjamin" || s == "cecilija");
if (s == "alojzije") {
int a;
cin >> a;
int x = 1;
vi v;
for (int j = limbo;j>=0;j--) {
x<<=1;
if (a&(1<<j)) x|=1;
v.push_back(x);
}
sort(all(v));
cout << big(v) << ' ';
for (auto it : v) cout << it << ' ';
cout << endl;
}
if (s == "benjamin") {
int b;
cin >> b;
int x = 1;
vi v;
for (int j = limbo;j>=0;j--) {
x<<=1;
if (b&(1<<j)) {
x|=1;
} else {
v.push_back(x^1);
}
}
cout << big(v) << ' ';
sort(all(v));
for (auto it : v) cout << it << ' ';
cout << endl;
}
if (s == "cecilija") {
int lc;
cin >> lc;
vi v(lc);
for (auto& it : v) cin >> it;
if (v.back() == 2) cout << "A" << endl;
else cout << "B" << endl;
}
}
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef Dodi
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
int t = 1;
//cin >> t;
while (t --> 0) 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... |