This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
/*
ID: samikgo1
TASK: wormhole
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = 1e9;
const ll modulo = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int ll
void encode1(){
int x;cin>>x;
vector<int> ans;
for(int i=1;i<=10;i++){
if(x&(1<<(i-1)))for(int j=0;j<i;j++)ans.emplace_back(i);
}
cout << ans.size() << ' ';
for(int&a:ans)cout<<a<<' ';
cout << '\n';
}
void encode2(){
int x;cin>>x;
vector<int> ans;
for(int i=1;i<=10;i++){
if(x&(1<<(i-1)))for(int j=0;j<i+10;j++)ans.emplace_back(i+10);
}
cout << ans.size() << ' ';
for(int&a:ans)cout<<a<<' ';
cout << '\n';
}
void decode(){
int a = 0;
int b = 0;
int l;cin>>l;
vector<int> arr(l);
for(int&i:arr)cin>>i;
for(int&i:arr){
if(i<=10){
a|=(1<<(i-1));
} else {
b|=(1<<(i-11));
}
}
if(a<b)cout<<"B\n";
else cout<<"A\n";
}
void solve(){
int l,Q;
cin >> l >> Q;
for (int i = 0; i < Q; i++) {
string a;cin>>a;
switch(a[0]){
case 'a':
encode1();
break;
case 'b':
encode2();
break;
case 'c':
decode();
break;
}
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// int t;
// cin >> t;
// while(t--)
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |