// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define pb push_back
#define sz(x) int(x.size())
using ll = long long;
template<class T> using V = vector<T>;
using vl = V<ll>;
using vi = V<int>;
int main() {
cin.tie(0)->sync_with_stdio(0);
int L, Q; cin >> L >> Q;
for(int q = 0; q < Q; q++) {
string s; cin >> s;
if (s[0] == 'a') {
int a; cin >> a; int cur = 0;
vi res; for(int i = 18; i >= 0; i--) {
if ((a >> i) & 1) {
cur |= (1 << i);
res.pb(cur);
}
}
cout << sz(res) << endl;
for(auto& x : res) cout << x << " ";
cout << endl;
}
if (s[0] == 'b') {
int b; cin >> b; int cur = 0;
vi res; for(int i = 18; i >= 0; i--) {
if ((b >> i) & 1) {
cur |= (1 << i);
} else res.pb(cur | (1 << i));
}
cout << sz(res) << endl;
for(auto& x : res) cout << x << " ";
cout << endl;
}
if (s[0] == 'c') {
int k; cin >> k;
vi A(k); for(auto& x : A) cin >> x;
if (A.back() != 1) cout << "A" << endl;
else cout << "B" << endl;
}
}
exit(0-0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
808 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1943 ms |
2844 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5047 ms |
139752 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |