Submission #1231039

#TimeUsernameProblemLanguageResultExecution timeMemory
1231039gelastropodMensza (COI22_mensza)C++20
100 / 100
4067 ms151272 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int L, Q; cin >> L >> Q; for (int i = 0; i < Q; i++) { string s; int x, a; cin >> s >> x; if (s == "alojzije") { vector<int> vals; int val = 0; for (int j = 0; j < 10; j++) { if (x & (1LL << j)) { vals.push_back(j * 2 + 1); val += j * 2 + 1; } } cout << val << '\n'; for (int j : vals) for (int k = 0; k < j; k++) cout << j << ' '; cout << '\n'; } if (s == "benjamin") { vector<int> vals; int val = 0; for (int j = 0; j < 10; j++) { if (x & (1LL << j)) { vals.push_back(j * 2 + 2); val += j * 2 + 2; } } cout << val << '\n'; for (int j : vals) for (int k = 0; k < j; k++) cout << j << ' '; cout << '\n'; } if (s == "cecilija") { int A = 0, B = 0; for (int j = 0; j < x; j++) { cin >> a; if (a % 2) A += (1LL << ((a - 1) / 2)); else B += (1LL << ((a - 2) / 2)); } cout << (A > B ? "A" : "B") << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...