64232023-11-28 21:29:44gergomiszoriTáblajátékcpp17Wrong answer 0/503ms4528 KiB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define endl "\n"
#define pll pair<ll,ll>
#define fs first
#define sc second

void solve()
{
    ll k;
    cin >> k;
    ll ans1 = 1, ans2 = 1;
    for(ll i = 0; i < k; i++)
    {
        ll l;
        cin >> l;
        if(l == 0)
        {
            ans2 += (ans2-1)*2;
            ans1++;
        }
        else
        if(l == 1)
        {
            ans2 += (ans2-1)*2 + 1;
            ans1++;
        }
        else
        if(l == 2)
        {
            ans1--;
            ans2 = (ans2/2)+1;
        }
        else
        if(l == 3)
        {
            ans2--;
        }
        else
        if(l == 4)
        {
            ans2++;
        }
    }
    cout << ans1 << endl;
    string s = "";
    while(ans2 > 1)
    {
        if(ans2 % 2 == 0) s += "0";
        else s += "1";
        ans2 /= 2;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1700 KiB
2Wrong answer0/03ms1860 KiB
3Wrong answer0/33ms2076 KiB
4Wrong answer0/33ms2308 KiB
5Wrong answer0/33ms2516 KiB
6Wrong answer0/33ms2732 KiB
7Wrong answer0/33ms3084 KiB
8Wrong answer0/33ms3172 KiB
9Wrong answer0/33ms3384 KiB
10Wrong answer0/33ms3468 KiB
11Wrong answer0/33ms3596 KiB
12Wrong answer0/33ms3808 KiB
13Wrong answer0/43ms4024 KiB
14Wrong answer0/43ms4212 KiB
15Wrong answer0/43ms4320 KiB
16Wrong answer0/43ms4300 KiB
17Wrong answer0/43ms4528 KiB