80812024-01-12 12:20:13BotiTáblajátékcpp17Partially correct 29/503ms3600 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int k, l;
    cin >> k;
    int s = 0;
    int m = 1;
    for (int i = 0; i < k; i++)
    {
        cin >> l;
        if (l == 0)
        {
            s++;
            m = m*2 -1;
        }
        else if (l == 1)
        {
            s++;
            m = m*2;
        }
        else if (l == 2)
        {
            s--;
            m = floor((m +1)/2);
        }
        else if (l == 3)
        {
            m--;
        }
        else if (l == 4)
        {
            m++;
        }
    }
    string o = "";
    m--;
    while (m > 0)
    {
        o = to_string(m % 2) + o;
        m -= m % 2;
        m /= 2;
    }
    cout << s << endl << o;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base29/50
1Accepted0/03ms2092 KiB
2Accepted0/03ms2124 KiB
3Partially correct1/33ms2316 KiB
4Accepted3/33ms2456 KiB
5Accepted3/33ms2688 KiB
6Partially correct1/33ms2876 KiB
7Accepted3/33ms3168 KiB
8Partially correct1/33ms3160 KiB
9Partially correct1/33ms3244 KiB
10Partially correct1/33ms3484 KiB
11Accepted3/32ms3444 KiB
12Partially correct1/33ms3564 KiB
13Accepted4/42ms3448 KiB
14Partially correct1/43ms3564 KiB
15Accepted4/43ms3564 KiB
16Partially correct1/43ms3600 KiB
17Partially correct1/43ms3452 KiB