#include <bits/stdc++.h>
using namespace std;
#define int long long
#define str string
#define vec vector
bool on(int x, int i) { return x & (1 << i); }
void slv(int tst) {
str typ; cin >> typ;
if (typ[0] == 'a') {
int x; cin >> x;
vec<int> ans;
for (int i = 0; i < 10; i++) {
for (int j = 1; j <= 2 * i; j++) ans.push_back(i);
if (on(x, i)) ans.push_back(i);
}
cout << ans.size() << " ";
for (int y : ans) cout << y << " ";
cout << endl;
} if (typ[0] == 'b') {
int x; cin >> x;
vec<int> ans;
for (int i = 0; i < 10; i++) {
for (int j = 1; j <= 2 * i + 1; j++) ans.push_back(i + 100);
if (on(x, i)) ans.push_back(i + 100);
}
cout << ans.size() << " ";
for (int y : ans) cout << y << " ";
cout << endl;
} if (typ[0] == 'c') {
int sz; cin >> sz;
vec<int> vl;
for (int i = 1; i <= sz; i++) {
int x; cin >> x;
vl.push_back(x);
}
reverse(vl.begin(), vl.end());
int x = 0, y = 0;
for (int i = 0; i < 10; i++) {
int j = vl.back() - 2 * i; vl.pop_back();
int k = vl.back() - (2 * i + 1); vl.pop_back();
x += j * powl(2, i), y = k * powl(2, i);
}
cout << ((x < y) ? "A" : "B") << endl;
}
}
signed main() {
// freopen("a.in", "r", stdin);
cin.sync_with_stdio(false), cin.tie(0);
int l, q; cin >> l >> q;
for (int i = 1; i <= q; i++) slv(i);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |