Submission #938189

#TimeUsernameProblemLanguageResultExecution timeMemory
938189PacybwoahMensza (COI22_mensza)C++17
100 / 100
1818 ms106184 KiB
#include<iostream> #include<string> #include<vector> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int q,l; cin>>l>>q; while(q--){ string s; cin>>s; if(s[0]=='a'){ int n; cin>>n; n+=(1<<20); vector<int> ans; while(n>1){ if(n&1) ans.push_back(n); n>>=1; } cout<<ans.size()<<" "; for(auto x:ans) cout<<x<<" "; cout<<"\n"; } else if(s[0]=='b'){ int n; cin>>n; n+=(1<<20); vector<int> ans; while(n>1){ if(n%2==0) ans.push_back(n^1); n>>=1; } cout<<ans.size()<<" "; for(auto x:ans) cout<<x<<" "; cout<<"\n"; } else{ int n; cin>>n; vector<int> vec(n); for(auto &x:vec) cin>>x; bool flag=0; for(auto x:vec){ if(x==2) flag=1; } if(flag) cout<<"A\n"; else cout<<"B\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...