79692024-01-12 09:23:52csaron71Táblajátékcpp17Partially correct 38/503ms3540 KiB
#include <bits/stdc++.h>

using namespace std;



int main()
{
    long long k;
    cin >> k;
    long long sor=0, hanyadik=0;
    for (int i=0; i<k; i++) {
        long long 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<long long> 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 (long long sz : kettessz) {
        cout << sz;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/03ms1812 KiB
2Accepted0/03ms2204 KiB
3Accepted3/33ms2280 KiB
4Accepted3/32ms2360 KiB
5Accepted3/32ms2356 KiB
6Partially correct1/33ms2492 KiB
7Accepted3/33ms2704 KiB
8Accepted3/32ms2792 KiB
9Accepted3/33ms2920 KiB
10Partially correct1/33ms2996 KiB
11Accepted3/32ms2996 KiB
12Partially correct1/33ms3000 KiB
13Accepted4/42ms2996 KiB
14Partially correct1/43ms3184 KiB
15Accepted4/43ms3432 KiB
16Partially correct1/43ms3512 KiB
17Accepted4/43ms3540 KiB