7552022-01-08 22:21:58Kevinke12Táblajátékcpp14Partially correct 36/502ms1964 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;


int N, aktO=0, l, ans1=0;
vector<char> almafa;
void Konv()
{
    almafa.clear();
    while(aktO>0)
    {
        if(aktO%2==1)
            almafa.push_back('1');
        else
            almafa.push_back('0');
        aktO/=2;
    }
}
int main()
{
    cin >> N;
    for(int i = 0; i < N; i++)
    {
        cin >> l;
        if((l==0) ||(l==1)) ans1++;
        if(l==2) ans1--;

        if(l==0)
            aktO = aktO*2;
         if(l==1)
            aktO = aktO*2+1;
         if(l==2) //fel
            aktO = aktO/2;
         if(l==3)
            aktO--;
         if(l==4)
            aktO++;

        //cout << ans1 << " " << aktO << "\n";

    }
    cout << ans1 << "\n";

    //cout << aktO << "\n";
    Konv();
    reverse(almafa.begin(), almafa.end());
    for(char c:almafa)
        cout << c;
    if(almafa.size()==0)
        cout << "0";



    /*for(int i = 0; i <= 50; i++)
    {
        aktO = i;
        cout << i << "=";
        Konv();
        reverse(almafa.begin(), almafa.end());
        for(char c:almafa)
            cout << c;
        cout << "\n";
    }*/
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/02ms1844 KiB
2Accepted0/01ms1848 KiB
3Accepted3/31ms1908 KiB
4Accepted3/31ms1916 KiB
5Accepted3/31ms1920 KiB
6Partially correct1/31ms1924 KiB
7Accepted3/31ms1936 KiB
8Partially correct1/31ms1936 KiB
9Accepted3/31ms1936 KiB
10Partially correct1/31ms1936 KiB
11Accepted3/31ms1940 KiB
12Partially correct1/31ms1948 KiB
13Accepted4/41ms1952 KiB
14Partially correct1/41ms1960 KiB
15Accepted4/41ms1956 KiB
16Partially correct1/41ms1960 KiB
17Accepted4/41ms1964 KiB