20742022-12-16 16:49:57bzsofiaTáblajátékcpp11Partially correct 31/503ms3604 KiB
#include <iostream>
//#include <fstream>
#include <deque>

using namespace std;

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

long long n, a, i, sor=0, elem=1;
deque <int> 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;

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

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

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base31/50
1Accepted0/03ms1940 KiB
2Accepted0/02ms2236 KiB
3Partially correct1/32ms2304 KiB
4Accepted3/32ms2440 KiB
5Accepted3/32ms2644 KiB
6Partially correct1/32ms2720 KiB
7Accepted3/32ms2716 KiB
8Accepted3/32ms2720 KiB
9Partially correct1/32ms2844 KiB
10Partially correct1/32ms2932 KiB
11Accepted3/32ms3132 KiB
12Partially correct1/32ms3216 KiB
13Accepted4/42ms3308 KiB
14Partially correct1/42ms3352 KiB
15Accepted4/42ms3356 KiB
16Partially correct1/42ms3484 KiB
17Partially correct1/42ms3604 KiB