Submission #990850

# Submission time Handle Problem Language Result Execution time Memory
990850 2024-05-31T13:45:24 Z alexdd Mensza (COI22_mensza) C++17
100 / 100
4918 ms 139560 KB
#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 time Memory Grader output
1 Correct 29 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2701 ms 2828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4918 ms 139560 KB Output is correct