# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019420 | MarwenElarbi | Mensza (COI22_mensza) | C++17 | 2462 ms | 170876 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define se second
#define fi first
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int nax=1e5+5;
int main() {
optimise;
int l,q;
cin>>l>>q;
while(q--){
string text;
cin>>text;
if(text[0]=='a'){
int a;
cin>>a;
a+=(1<<20);
int cur=(1<<20);
vector<int> v;
for (int i = 19; i >= 0; --i)
{
cur+=((a&(1<<i)) ? (1<<i) : 0);
if(a&(1<<i)) v.pb(cur);
}
cout <<v.size()<<endl;
for (int i = 0; i < v.size(); ++i)
{
cout <<v[i]<<" ";
}cout <<'\n';
}else if(text[0]=='b'){
int b;
cin>>b;
b+=(1<<20);
int cur=(1<<20);
vector<int> v;
for (int i = 19; i >= 0; --i)
{
cur+=((b&(1<<i)) ? (1<<i) : 0);
if(!(b&(1<<i))) v.pb(cur+(1<<i));
}
cout <<v.size()<<endl;
for (int i = 0; i < v.size(); ++i)
{
cout <<v[i]<<" ";
}cout <<'\n';
}else{
int c;
cin>>c;
vector<int> tab(c);
for (int i = 0; i < c; ++i)
{
cin>>tab[i];
}
cout << (tab[c-1]==2 ? "A" : "B") <<'\n';
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |