8182022-01-17 11:35:38zsebiTáblajátékcpp11Partially correct 36/502ms1968 KiB
#include <iostream>
//#include <fstream>

using namespace std;

//ifstream cin("tablajatek.in");
//ofstream cout("tablajatek.out");

int x[100001],a,sor,szam,i,j,n;
int main()
{
    cin>>n;
    sor=0;
    szam=0;

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


        if(a<=1)
        {
            sor++;
            szam=szam*2+a;

        }

        else if(a==2)
        {
           sor--;
           szam=szam/2;

        }
        else if(a==3)
        {
            szam--;
        }
        else if (a==4)
        {
            szam++;
        }

    }

    cout<<sor<<"\n";

    i=1;
    if(szam==0)cout<<"0";
    else
    {
         while(szam)
    {

        x[i]=szam%2;
        szam=szam/2;
        i++;

    }
    }


    for(j=i-1;j>=1;--j)cout<<x[j];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/02ms1808 KiB
2Accepted0/02ms1852 KiB
3Accepted3/31ms1908 KiB
4Accepted3/31ms1916 KiB
5Accepted3/31ms1920 KiB
6Partially correct1/31ms1924 KiB
7Accepted3/31ms1928 KiB
8Partially correct1/31ms1932 KiB
9Accepted3/31ms1940 KiB
10Partially correct1/32ms1940 KiB
11Accepted3/31ms1944 KiB
12Partially correct1/31ms1948 KiB
13Accepted4/41ms1952 KiB
14Partially correct1/41ms1952 KiB
15Accepted4/42ms1960 KiB
16Partially correct1/41ms1964 KiB
17Accepted4/41ms1968 KiB