#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define per(i, l, r) for (int i = (r - 1); i >= l; --i)
#define ALL(x) (x).begin(), (x).end()
using i64 = long long;
void main_() {
int L, Q;
cin >> L >> Q;
while (Q--) {
string str;
cin >> str;
if (str[0] == 'a') {
int N;
cin >> N;
vector<int> ret;
int v = 0;
per(i, 0, 18) {
if (N & (1 << i)) {
v |= 1 << i;
ret.push_back(v);
}
}
cout << ret.size();
for (const auto e : ret) cout << ' ' << e;
cout << endl;
}
if (str[0] == 'b') {
int N;
cin >> N;
vector<int> ret;
int v = 0;
per(i, 0, 18) {
if (N & (1 << i)) {
v |= 1 << i;
} else {
ret.push_back(v | (1 << i));
}
}
cout << ret.size();
for (const auto e : ret) cout << ' ' << e;
cout << endl;
}
if (str[0] == 'c') {
int N;
cin >> N;
vector<int> c(N);
for (auto &e : c) cin >> e;
bool ans = c.back() == 1;
cout << (ans ? 'B' : 'A') << endl;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
main_();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1918 ms |
2832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3913 ms |
126920 KB |
Wrong answer on query 9902: expected A, found B |
2 |
Halted |
0 ms |
0 KB |
- |