20752022-12-16 16:53:38bzsofiaTáblajátékcpp11Partially correct 38/503ms3784 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;
    }

    if (v.empty()) cout<<0;
    for (auto &e:v)
    {
        cout<<e;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/03ms1808 KiB
2Accepted0/02ms2004 KiB
3Accepted3/32ms2144 KiB
4Accepted3/32ms2308 KiB
5Accepted3/32ms2660 KiB
6Partially correct1/32ms2720 KiB
7Accepted3/32ms2796 KiB
8Accepted3/32ms2924 KiB
9Accepted3/32ms3004 KiB
10Partially correct1/32ms3284 KiB
11Accepted3/32ms3216 KiB
12Partially correct1/32ms3240 KiB
13Accepted4/42ms3344 KiB
14Partially correct1/42ms3420 KiB
15Accepted4/42ms3684 KiB
16Partially correct1/42ms3784 KiB
17Accepted4/42ms3704 KiB