7742022-01-10 15:26:17Kevinke12Táblajátékcpp14Partially correct 38/502ms1972 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;


long long 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";


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/02ms1840 KiB
2Accepted0/01ms1852 KiB
3Accepted3/31ms1912 KiB
4Accepted3/31ms1920 KiB
5Accepted3/31ms1924 KiB
6Partially correct1/31ms1928 KiB
7Accepted3/31ms1932 KiB
8Accepted3/31ms1940 KiB
9Accepted3/31ms1936 KiB
10Partially correct1/31ms1948 KiB
11Accepted3/31ms1952 KiB
12Partially correct1/31ms1952 KiB
13Accepted4/41ms1952 KiB
14Partially correct1/41ms1956 KiB
15Accepted4/41ms1964 KiB
16Partially correct1/41ms1972 KiB
17Accepted4/41ms1972 KiB