33992023-02-27 12:39:39AblablablaTáblajátékcpp11Partially correct 36/503ms4004 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> lepesek(n, 0);
    int melyseg = 0;
    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<int> valasz;
    bool a = false;
    if(szelesseg == 0){
        a = true;
    }
    while(szelesseg > 0){
        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
base36/50
1Accepted0/03ms1960 KiB
2Accepted0/03ms2208 KiB
3Accepted3/33ms2316 KiB
4Accepted3/33ms2448 KiB
5Accepted3/33ms2528 KiB
6Partially correct1/33ms2660 KiB
7Accepted3/33ms2868 KiB
8Partially correct1/33ms3116 KiB
9Accepted3/33ms3252 KiB
10Partially correct1/33ms3464 KiB
11Accepted3/33ms3552 KiB
12Partially correct1/33ms3548 KiB
13Accepted4/43ms3684 KiB
14Partially correct1/43ms3764 KiB
15Accepted4/43ms3760 KiB
16Partially correct1/43ms3764 KiB
17Accepted4/43ms4004 KiB