Submission #938189

# Submission time Handle Problem Language Result Execution time Memory
938189 2024-03-05T01:56:40 Z Pacybwoah Mensza (COI22_mensza) C++17
100 / 100
1818 ms 106184 KB
#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 time Memory Grader output
1 Correct 9 ms 700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 851 ms 2832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1818 ms 106184 KB Output is correct