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 "bits/stdc++.h"
using namespace std;
using ll = long long;
void solve() {
int l, q;
cin >> l >> q;
assert(l >= 110);
while (q--) {
string op;
cin >> op;
if (op == "alojzije") {
int a;
cin >> a;
vector<int> v;
for (int i = 0; i < 10; i++) {
if (!(a & (1 << i))) continue;
int p = i * 2 + 1;
for (int j = 0; j < p; j++) v.emplace_back(p);
}
cout << v.size() << ' ';
for (int x: v) cout << x << ' ';
} else if (op == "benjamin") {
int b;
cin >> b;
vector<int> v;
for (int i = 0; i < 10; i++) {
if (!(b & (1 << i))) continue;
int p = i * 2 + 2;
for (int j = 0; j < p; j++) v.emplace_back(p);
}
cout << v.size() << ' ';
for (int x: v) cout << x << ' ';
} else {
int n;
cin >> n;
int a = 0, b = 0;
while (n--) {
int x;
cin >> x;
if (x % 2) {
a += 1 << ((x - 1) / 2);
} else {
b += 1 << ((x - 2) / 2);
}
}
cout << (a > b ? "A" : "B");
}
cout << '\n';
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int q = 1;
// cin >> q;
while (q--) {
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... |