Submission #777348

# Submission time Handle Problem Language Result Execution time Memory
777348 2023-07-09T06:29:45 Z The_Samurai Mensza (COI22_mensza) C++17
34 / 100
591 ms 3212 KB
#include "bits/stdc++.h"

using namespace std;
using ll = long long;


void solve() {
    int l, q;
    cin >> l >> q;
    assert(l >= 110);
    while (q--) {
        string op;
        cin >> op;
        if (op == "alojzije") {
            int a;
            cin >> a;
            vector<int> v;
            for (int i = 0; i < 10; i++) {
                if (!(a & (1 << i))) continue;
                int p = i * 2 + 1;
                for (int j = 0; j < p; j++) v.emplace_back(p);
            }
            cout << v.size() << ' ';
            for (int x: v) cout << x << ' ';
        } else if (op == "benjamin") {
            int b;
            cin >> b;
            vector<int> v;
            for (int i = 0; i < 10; i++) {
                if (!(b & (1 << i))) continue;
                int p = i * 2 + 2;
                for (int j = 0; j < p; j++) v.emplace_back(p);
            }
            cout << v.size() << ' ';
            for (int x: v) cout << x << ' ';
        } else {
            int n;
            cin >> n;
            int a = 0, b = 0;
            while (n--) {
                int x;
                cin >> x;
                if (x % 2) {
                    a += 1 << ((x - 1) / 2);
                } else {
                    b += 1 << ((x - 2) / 2);
                }
            }
            cout << (a > b ? "A" : "B");
        }
        cout << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int q = 1;
//    cin >> q;
    while (q--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 591 ms 3212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -