Submission #990850

#TimeUsernameProblemLanguageResultExecution timeMemory
990850alexddMensza (COI22_mensza)C++17
100 / 100
4918 ms139560 KiB
#include<bits/stdc++.h> using namespace std; int maxlun,q; void solve_a() { int a,suff=0; cin>>a; vector<int> v; for(int i=18;i>=0;i--) { if(((1<<i)&a)) { suff += (1<<i); v.push_back(suff); } } cout<<v.size()<<" "; for(auto x:v) cout<<x<<" "; cout<<"\n"; } void solve_b() { int b,suff=0; cin>>b; vector<int> v; for(int i=18;i>=0;i--) { if(((1<<i)&b)) { suff += (1<<i); } else { v.push_back(suff+(1<<i)); } } cout<<v.size()<<" "; for(auto x:v) cout<<x<<" "; cout<<"\n"; } void solve_c() { int lun,x; cin>>lun; for(int i=1;i<=lun;i++) cin>>x; if(x>1) cout<<"A\n"; else cout<<"B\n"; } signed main() { cin>>maxlun>>q; string tip; while(q--) { cin>>tip; if(tip=="alojzije") { solve_a(); } else if(tip=="benjamin") { solve_b(); } else { solve_c(); } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...