Submission #959792

#TimeUsernameProblemLanguageResultExecution timeMemory
959792Darren0724Mensza (COI22_mensza)C++17
34 / 100
5021 ms272152 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...