Submission #1231075

#TimeUsernameProblemLanguageResultExecution timeMemory
1231075siewjhMensza (COI22_mensza)C++20
0 / 100
2316 ms151400 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int lim, queries; cin >> lim >> queries;
	while (queries--){
		string op; cin >> op;
		if (op == "alojzije"){
			int x; cin >> x;
			vector<int> ans;
			for (int i = 0; i < 10; i++)
				if (x & (1 << i)){
					int amt = (i << 1) + 1;
					for (int j = 0; j < amt; j++) ans.push_back(amt);
				}
			cout << ans.size() << ' ';
			for (int x : ans) cout << x << ' ';
		}
		else if (op == "benjamin"){
			int x; cin >> x;
			vector<int> ans;
			for (int i = 0; i < 10; i++)
				if (x & (1 << i)){
					int amt = (i << 1) + 2;
					for (int j = 0; j < amt; j++) ans.push_back(amt);
				}
			cout << ans.size() << ' ';
			for (int x : ans) cout << x << ' ';
		}
		else{
			int nums; cin >> nums;
			int a = 0, b = 0;
			for (int i = 0; i < nums; i++){
				int x; cin >> x;
				if (x & 1) a += 1 << ((x - 1) >> 1);
				else b += 1 << ((x - 2) >> 1);
			}
			cout << (a > b ? 'A' : 'B');
		}
		cout << '\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...