Submission #1298874

#TimeUsernameProblemLanguageResultExecution timeMemory
1298874AMnuMensza (COI22_mensza)C++20
0 / 100
2118 ms69984 KiB
#include <bits/stdc++.h> using namespace std; const int LOG = 18; int Q, N, X; string S; int main() { cin >> N >> Q; while (Q--) { cin >> S >> N; vector <int> v; if (S[0] == 'a') { X = 1; for (int i=LOG;i>=0;i--) { if ((N>>i)&1) { X = X*2+1; } else { X = X*2; } v.push_back(X); } } if (S[0] == 'b') { X = 1; for (int i=LOG;i>=0;i--) { if ((N>>i)&1) { // v.push_back(X*2); X = X*2+1; } else { v.push_back(X*2+1); X = X*2; } } } if (S[0] == 'c') { while (N--) { cin >> X; } if (X == 2) { cout << "A" << endl; } else { cout << "B" << endl; } continue; } cout << v.size(); for (int x : v) { cout << " " << x; } cout << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...