33982023-02-27 12:37:18AblablablaTáblajátékcpp11Wrong answer 22/503ms3932 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;
    while(szelesseg > 0){
        int mar = szelesseg % 2;
        valasz.push_back(mar);
        szelesseg = szelesseg / 2;
    }

    cout  << melyseg << "\n";
    if(szelesseg == 0){
        cout << 0;
    } else{
        for(int i = valasz.size() - 1; i >= 0; i--){
            cout << valasz[i];
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base22/50
1Wrong answer0/03ms1812 KiB
2Wrong answer0/03ms2004 KiB
3Accepted3/33ms2252 KiB
4Partially correct1/33ms2468 KiB
5Partially correct1/33ms2540 KiB
6Partially correct1/33ms2620 KiB
7Partially correct1/33ms2616 KiB
8Partially correct1/33ms2752 KiB
9Accepted3/33ms2864 KiB
10Partially correct1/33ms2964 KiB
11Partially correct1/33ms3172 KiB
12Partially correct1/33ms3420 KiB
13Partially correct1/43ms3596 KiB
14Partially correct1/43ms3716 KiB
15Partially correct1/43ms3800 KiB
16Partially correct1/43ms3808 KiB
17Accepted4/43ms3932 KiB