63942023-11-27 11:06:10MrChipserTáblajátékcpp11Partially correct 36/503ms3900 KiB
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int x = 1;
    int y = 1;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if(a==0)
        {
            y++;
            x=x*2-1;
        }
        if(a==1)
        {
            y++;
            x=x*2;
        }
        if(a==2)
        {
            y--;
            if(x%2==0)
                x=x/2;
            else
                x=(x+1)/2;
        }
        if(a==3)
            x--;
        if(a==4)
            x++;
        //cout << x << " " << y << endl;
    }
    cout << y-1 << endl;
    vector<int>binary;
    x--;
    if(x==0)
        cout << 0;
    else
    {
    while(x!=0)
    {
        binary.insert(binary.begin(),x%2);
        x/=2;
    }
    for(int i = 0; i < binary.size(); i++)
        cout << binary[i];
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/03ms1684 KiB
2Accepted0/03ms1848 KiB
3Accepted3/33ms2060 KiB
4Accepted3/33ms2268 KiB
5Accepted3/32ms2356 KiB
6Partially correct1/33ms2748 KiB
7Accepted3/33ms2796 KiB
8Partially correct1/33ms2872 KiB
9Accepted3/33ms3000 KiB
10Partially correct1/33ms3088 KiB
11Accepted3/33ms3212 KiB
12Partially correct1/33ms3468 KiB
13Accepted4/43ms3456 KiB
14Partially correct1/43ms3460 KiB
15Accepted4/43ms3572 KiB
16Partially correct1/43ms3816 KiB
17Accepted4/43ms3900 KiB