답안 #964030

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964030 2024-04-16T08:24:25 Z becaido Mensza (COI22_mensza) C++17
100 / 100
1771 ms 137596 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 foo = 114514, q;

void solve() {
    cin >> foo >> q;
    while (q--) {
        string s;
        cin >> s;
        if (s[0] == 'a') {
            int x, cur = 0;
            vector<int> v;
            cin >> x;
            for (int i = 18; i >= 0; i--) if (x >> i & 1) v.pb(cur |= 1 << i);
            cout << v.size();
            for (int x : v) cout << ' ' << x;
            cout << '\n';
        }
        if (s[0] == 'b') {
            int x, cur = 0;
            vector<int> v;
            cin >> x;
            for (int i = 18; i >= 0; i--) {
                if (x >> i & 1) cur |= 1 << i;
                else v.pb(cur | (1 << i));
            }
            cout << v.size();
            for (int x : v) cout << ' ' << x;
            cout << '\n';
        }
        if (s[0] == 'c') {
            int n, x;
            cin >> n;
            while (n--) cin >> x;
            cout << (x > 1 ? 'A' : 'B') << '\n';
        }
    }
}

int main() {
    Waimai;
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 867 ms 2804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1771 ms 137596 KB Output is correct