34002023-02-27 12:45:58AblablablaTáblajátékcpp11Partially correct 38/503ms3808 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> lepesek(n, 0);
    int melyseg = 0;
    long long int szelesseg = 0;
    for(int i = 0; i < n; i++){
        cin >> lepesek[i];
        if(lepesek[i] == 0){
            melyseg++;
            //if(szelesseg != 0){
            szelesseg = szelesseg * 2;
            //}
        }else if(lepesek[i] == 1){
            melyseg++;
            szelesseg = szelesseg * 2 + 1;
        } else if(lepesek[i] == 2){
            melyseg--;
            szelesseg /= 2;
        } else if(lepesek[i] == 3){
            szelesseg--;
        } else{
            szelesseg++;
        }
    }

    //szelesseg = 100;
    vector<long long int> valasz;
    bool a = false;
    if(szelesseg == 0){
        a = true;
    }
    while(szelesseg > 0){
        long long int mar = szelesseg % 2;
        valasz.push_back(mar);
        szelesseg = szelesseg / 2;
    }

    cout  << melyseg << "\n";
    if(a){
        cout << "0";
    } else{
        for(int i = valasz.size() - 1; i >= 0; i--){
            cout << valasz[i];
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/03ms1812 KiB
2Accepted0/03ms2016 KiB
3Accepted3/33ms2232 KiB
4Accepted3/33ms2468 KiB
5Accepted3/33ms2680 KiB
6Partially correct1/33ms2864 KiB
7Accepted3/33ms2944 KiB
8Accepted3/33ms2944 KiB
9Accepted3/32ms2964 KiB
10Partially correct1/33ms3084 KiB
11Accepted3/32ms3160 KiB
12Partially correct1/33ms3300 KiB
13Accepted4/43ms3408 KiB
14Partially correct1/43ms3596 KiB
15Accepted4/43ms3720 KiB
16Partially correct1/43ms3680 KiB
17Accepted4/43ms3808 KiB