Submission #963981

# Submission time Handle Problem Language Result Execution time Memory
963981 2024-04-16T06:58:06 Z becaido Mensza (COI22_mensza) C++17
34 / 100
3374 ms 151316 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

int len, q;

void solve() {
    cin >> len >> q;
    while (q--) {
        string s;
        cin >> s;
        if (s[0] == 'a' || s[0] == 'b') {
            int x;
            vector<int> v;
            cin >> x;
            for (int i = 0; i < 10; i++) if (x >> i & 1) {
                int c = i + 1;
                if (s[0] == 'a' && i >= 5) c += 10;
                if (s[0] == 'b' && i < 5) c += 10;
                FOR (j, 1, c) v.pb(c);
            }
            cout << v.size() << ' ';
            for (int x : v) cout << x << ' ';
            cout << '\n';
        } else {
            int n, mask = 0;
            cin >> n;
            while (n--) {
                int x;
                cin >> x;
                mask |= 1 << x;
            }
            for (int i = 10; i >= 1; i--) if ((mask >> i & 1) != (mask >> (10 + i) & 1)) {
                if (mask >> i & 1) {
                    cout << (i <= 5 ? 'A' : 'B');
                } else {
                    cout << (i <= 5 ? 'B' : 'A');
                }
                cout << '\n';
                break;
            }
        }
    }
}

int main() {
    Waimai;
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 597 ms 3188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3374 ms 151316 KB Integer parameter [name=l_6] equals to 23, violates the range [0, 20]
2 Halted 0 ms 0 KB -