20762022-12-16 17:03:01bzsofiaTáblajátékcpp11Partially correct 38/503ms3796 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()
{
    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/03ms1812 KiB
2Accepted0/02ms2056 KiB
3Accepted3/32ms2132 KiB
4Accepted3/32ms2208 KiB
5Accepted3/32ms2448 KiB
6Partially correct1/32ms2660 KiB
7Accepted3/32ms2724 KiB
8Accepted3/32ms2924 KiB
9Accepted3/32ms2988 KiB
10Partially correct1/32ms3236 KiB
11Accepted3/32ms3440 KiB
12Partially correct1/32ms3604 KiB
13Accepted4/42ms3684 KiB
14Partially correct1/42ms3684 KiB
15Accepted4/42ms3684 KiB
16Partially correct1/42ms3792 KiB
17Accepted4/42ms3796 KiB