Submission #850615

#TimeUsernameProblemLanguageResultExecution timeMemory
850615CyanmondMensza (COI22_mensza)C++17
34 / 100
3913 ms126920 KiB
#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_(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...