142262025-01-10 09:58:16szabelrTáblajátékcpp17Partially correct 29/501ms548 KiB
#include <iostream>

using namespace std;

int main()
{
    int k,x,sor=0,hely=1;
    cin>>k;
    for(int i=1; i<=k; i++){
        cin>>x;
        if(x==0){
            sor++;
            hely=hely*2-1;
        }
        else if(x==1){
            sor++;
            hely=hely*2;
        }
        else if(x==2){
            sor--;
            hely=hely/2+hely%2;
        }

        else if(x==3){
            hely--;
        }
        else if(x==4){
            hely++;
        }
    }
    cout<<sor<<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
base29/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Partially correct1/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms508 KiB
6Partially correct1/31ms316 KiB
7Accepted3/31ms316 KiB
8Partially correct1/31ms316 KiB
9Partially correct1/31ms316 KiB
10Partially correct1/31ms548 KiB
11Accepted3/31ms316 KiB
12Partially correct1/31ms316 KiB
13Accepted4/41ms408 KiB
14Partially correct1/41ms540 KiB
15Accepted4/41ms316 KiB
16Partially correct1/41ms316 KiB
17Partially correct1/41ms548 KiB