142222025-01-10 09:56:54szabelrTáblajátékcpp17Partially correct 27/501ms508 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 and hely%2==0){
            sor--;
            hely=hely/2;
        }
        else if(x==2 and hely%2==1){
            sor--;
            hely=(hely+1)/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
base27/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Partially correct1/31ms316 KiB
4Accepted3/31ms508 KiB
5Accepted3/31ms316 KiB
6Partially correct1/31ms316 KiB
7Accepted3/31ms508 KiB
8Wrong answer0/31ms316 KiB
9Partially correct1/31ms316 KiB
10Partially correct1/31ms316 KiB
11Accepted3/31ms316 KiB
12Partially correct1/31ms316 KiB
13Accepted4/41ms316 KiB
14Partially correct1/41ms508 KiB
15Accepted4/41ms316 KiB
16Wrong answer0/41ms316 KiB
17Partially correct1/41ms344 KiB