#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
//#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
int32_t main() {
LCBorz;
int l,q;cin>>l>>q;
for(int i=0;i<q;i++){
string s;cin>>s;
if(s[0]=='a'){
int k;cin>>k;
vector<int> v;
for(int i=0;i<20;i++){
if((1<<i)&k){
for(int j=0;j<i*2+1;j++){
v.push_back(i*2+1);
}
}
}
cout<<v.size()<<' ';
for(int j:v){
cout<<j<<' ';
}
cout<<endl;
}
if(s[0]=='b'){
int k;cin>>k;
vector<int> v;
for(int i=0;i<20;i++){
if((1<<i)&k){
for(int j=0;j<i*2+2;j++){
v.push_back(i*2+2);
}
}
}
cout<<v.size()<<endl;
for(int j:v){
cout<<j<<' ';
}
cout<<endl;
}
if(s[0]=='c'){
int m;cin>>m;
vector<int> v(m);
for(int j=0;j<m;j++){
cin>>v[j];
}
int a=0,b=0;
for(int j:v){
if(j&1){
a|=1<<((j-1)/2);
}
else{
b|=1<<((j-2)/2);
}
}
cout<<(a>b?"A":"B")<<endl;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
638 ms |
3208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5021 ms |
272152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |