Submission #960976

# Submission time Handle Problem Language Result Execution time Memory
960976 2024-04-11T10:21:56 Z Pring Mensza (COI22_mensza) C++17
100 / 100
1904 ms 116712 KB
#include <bits/stdc++.h>
using namespace std;

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;

const int MXN = 55;
int L, q, n;
string s;

void fa() {
	vector<int> v;
	cin >> n;
	FOR(i, 0, 19) {
		int x = (n >> i);
		if (x & 1) v.push_back((x << 5) + i);
	}
	cout << v.size() << ' ';
	for (auto &i : v) cout << i << ' ';
	cout << '\n';
}

void fb() {
	vector<int> v;
	cin >> n;
	FOR(i, 0, 19) {
		int x = (n >> i);
		if (!(x & 1)) v.push_back(((x | 1) << 5) + i);
	}
	cout << v.size() << ' ';
	for (auto &i : v) cout << i << ' ';
	cout << '\n';
}

void fc() {
	int br;
	cin >> n;
	while (n--) cin >> br;
	cout << (br == 2 ? 'A' : 'B') << '\n';
}

void miku() {
	cin >> L >> q;
	while (q--) {
		cin >> s;
		if (s[0] == 'a') fa();
		else if (s[0] == 'b') fb();
		else fc();
	}
}

int32_t main() {
	cin.tie(0) -> sync_with_stdio(false);
	cin.exceptions(cin.failbit);
	miku();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 865 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1904 ms 116712 KB Output is correct