20772022-12-16 17:03:41bzsofiaTáblajátékcpp11Partially correct 38/503ms4096 KiB
#include <iostream>
//#include <fstream>
#include <deque>

using namespace std;

//ifstream fin("be.in");

long long n, a, i, sor=0, elem=1;
deque <bool> v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n;

    for (i=1; i<=n; ++i)
    {
        cin>>a;

        if (a==0)
        {
            ++sor;
            elem=elem*2-1;
        }else if (a==1)
        {
            ++sor;
            elem=elem*2;
        }else if (a==2)
        {
            --sor;
            elem=elem/2+elem%2;
        }else if(a==3) --elem;
        else ++elem;
    }

    cout<<sor<<"\n";
    --elem;

    if (elem==0)
    {
        cout<<elem;
        return 0;
    }

    while (elem)
    {
        v.push_front(elem%2);
        elem/=2;
    }

    for (auto &e:v)
    {
        cout<<e;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/03ms1700 KiB
2Accepted0/02ms1924 KiB
3Accepted3/32ms2132 KiB
4Accepted3/32ms2336 KiB
5Accepted3/32ms2476 KiB
6Partially correct1/32ms2676 KiB
7Accepted3/32ms2880 KiB
8Accepted3/32ms2956 KiB
9Accepted3/32ms3104 KiB
10Partially correct1/32ms3212 KiB
11Accepted3/32ms3224 KiB
12Partially correct1/32ms3356 KiB
13Accepted4/42ms3560 KiB
14Partially correct1/42ms3764 KiB
15Accepted4/42ms3860 KiB
16Partially correct1/42ms3968 KiB
17Accepted4/42ms4096 KiB