#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define F first
#define S second
#define sz(x) int(x.size())
const int V=1e9;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int L;
cin >> L;
int Q;
cin >> Q;
while(Q--) {
string s;
cin >> s;
if(s[0]=='a') {
int A;
cin >> A;
cout << A << ' ';
for(int i=0; i<A; i++) {
cout << i << ' ';
}
cout << '\n';
}
else if(s[0]=='b') {
int B;
cin >> B;
cout << B << ' ';
if(B%2==0) {
for(int i=0; i<B/2; i++) {
cout << i << ' ' << i << ' ';
}
cout << '\n';
}
else {
cout << V << ' ' << V << ' ' << V << ' ';
B-=3;
for(int i=0; i<B/2; i++) {
cout << i << ' ' << i << ' ';
}
cout << '\n';
}
}
else {
int d;
cin >> d;
int A=0, B=0;
for(int i=0; i<d; i++) {
int x;
cin >> x;
if(x==1) {
A+=x;
}
else {
B+=x;
}
}
if(A>B) {
cout << "A\n";
}
else {
cout << "B\n";
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |