7712022-01-10 11:13:28kicsiboglarTalálkozáscpp11Wrong answer 1/5534ms7220 KiB
#include <iostream>
#include <deque>
#define ll long long 

using namespace std;

int n, i, a, s, o;

/*void bin(ll m)
{
    ll x[501], db = 0;
    while (m > 0)
    {
        x[db] = m % 2;
        m /= 2;
        db++;
    }
    if (db == 0) cout << "0";
    else for (i = db-1; i >= 0; --i) cout << x[i];
}*/

void binary(int m)
{
    if (m<2)
    {
        cout << m;
    }
    else
    {
        deque <int> x;
        while (m >=1)
        {
            x.push_front(m % 2);
            m = m / 2;
        }
        for (auto e : x) cout << e;
    }
    /*if ((m / 2) > 0) binary(m / 2);
    cout << m % 2;*/
}
int main()
{
    cin >> n;
    s = 0;
    o = 0;
    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        if (a <= 1)
        {
            s++;
            o = (o * 2) + a;
        }
        else if (a == 2)
        {
            s--;
            o /= 2;
        }
        else if (a == 3) o--;
        else o++;
    }
    cout << s << "\n";
    binary(o);
    return 0;
}



SubtaskSumTestVerdictTimeMemory
base1/55
1Wrong answer0/02ms1740 KiB
2Wrong answer0/034ms2492 KiB
3Wrong answer0/21ms2600 KiB
4Wrong answer0/21ms2604 KiB
5Wrong answer0/21ms2616 KiB
6Wrong answer0/21ms2612 KiB
7Wrong answer0/21ms2616 KiB
8Wrong answer0/31ms2620 KiB
9Wrong answer0/31ms2624 KiB
10Wrong answer0/31ms2632 KiB
11Wrong answer0/33ms2636 KiB
12Wrong answer0/34ms2716 KiB
13Wrong answer0/34ms2828 KiB
14Wrong answer0/38ms3068 KiB
15Wrong answer0/37ms3292 KiB
16Wrong answer0/37ms3520 KiB
17Wrong answer0/37ms3740 KiB
18Wrong answer0/310ms4084 KiB
19Partially correct1/332ms4964 KiB
20Wrong answer0/326ms5596 KiB
21Wrong answer0/330ms6460 KiB
22Wrong answer0/332ms7220 KiB