74142024-01-08 16:05:52szabelrTáblajátékcpp17Partially correct 31/503ms4968 KiB
#include <iostream>

using namespace std;
long long sor=1,hely=1,k,x,z=1,kettes=0;

int main()
{
    //long long sor=1,hely=1,k,x,z=1,kettes=0;
    cin>>k;
    for(int i=1; i<=k; i++){
        cin>>x;
        if(x==0)
        {
           sor++;
           hely=hely*2-1;
        }
        if(x==1)
        {
            sor++;
            hely=hely*2;
        }
        if(x==2)
        {
            sor--;
            hely=hely/2+hely%2;
        }
        if(x==3)
        {
            hely--;
        }
        if(x==4)
        {
            hely++;
        }
    }
    cout<<sor-1<<endl;
    hely=hely-1;
    int a[100000],hossz=0;
    //cout<<hely<<endl;
    while(hely>0){
        hossz++;
        a[hossz]=hely%2;
        hely=hely/2;
    }
    for(int i=hossz; i>=1; i--){
        cout<<a[i];
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base31/50
1Accepted0/03ms2644 KiB
2Accepted0/03ms2888 KiB
3Partially correct1/33ms3124 KiB
4Accepted3/33ms3340 KiB
5Accepted3/33ms3652 KiB
6Partially correct1/33ms3692 KiB
7Accepted3/33ms3908 KiB
8Accepted3/33ms3996 KiB
9Partially correct1/33ms4088 KiB
10Partially correct1/33ms4220 KiB
11Accepted3/33ms4308 KiB
12Partially correct1/33ms4432 KiB
13Accepted4/43ms4676 KiB
14Partially correct1/43ms4752 KiB
15Accepted4/43ms4968 KiB
16Partially correct1/43ms4864 KiB
17Partially correct1/43ms4864 KiB