79622024-01-12 09:09:30csaron71Táblajátékcpp17Partially correct 36/503ms3984 KiB
#include <bits/stdc++.h>

using namespace std;



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

    cout << sor << "\n";
    //cout << hanyadik  << "\n";
    if (hanyadik==0) {
        cout << "0";
    }
    vector<int> kettessz;
    hanyadik*=2;
    while (hanyadik>1) {
        hanyadik/=2;

        if (hanyadik%2==1) {
            kettessz.push_back(1);
        }
        else {
            kettessz.push_back(0);
        }
    }

    reverse(kettessz.begin(), kettessz.end());
    for (int sz : kettessz) {
        cout << sz;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/03ms1812 KiB
2Accepted0/03ms2012 KiB
3Accepted3/33ms2220 KiB
4Accepted3/33ms2440 KiB
5Accepted3/33ms2676 KiB
6Partially correct1/33ms2728 KiB
7Accepted3/33ms2824 KiB
8Partially correct1/33ms2944 KiB
9Accepted3/33ms3072 KiB
10Partially correct1/33ms3288 KiB
11Accepted3/33ms3392 KiB
12Partially correct1/33ms3400 KiB
13Accepted4/43ms3532 KiB
14Partially correct1/43ms3756 KiB
15Accepted4/43ms3864 KiB
16Partially correct1/43ms3956 KiB
17Accepted4/43ms3984 KiB