18082022-12-03 20:29:11kdbTáblajátékcpp11Wrong answer 28/503ms4352 KiB
#include <iostream>
#include <vector>
#include <map>
#include <deque>
using namespace std;
#define ll long long

ostream& operator<<(ostream& os, vector<int>& input)
{
    for (auto i : input)
    {
        os << i << " ";
    }
    return os;
}

void q(int n)
{
    if (n / 2 != 0)
    {
        q(n / 2);
    }
    cout << n%2;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    int r = 0, c = 0;
    while (n--)
    {
        int a;
        cin >> a;
        if (a == 0)
        {
            c *= 2;
            r++;
        }
        else if (a == 1)
        {
            c = c * 2 + 1;
            r++;
        }
        else if (a == 2)
        {
            c /= c;
            r--;
        }
        else if (a == 3)
        {
            c--;
        }
        else if (a == 4)
        {
            c++;
        }
    }
    cout << r << endl;
    q(c);
    return 0;
}
/*
6
0 1 4 2 1 0
-3
-110

6
0 0 0 0 0 0
-6
-0
*/
SubtaskSumTestVerdictTimeMemory
base28/50
1Accepted0/03ms2016 KiB
2Wrong answer0/02ms2160 KiB
3Accepted3/32ms2344 KiB
4Accepted3/32ms2672 KiB
5Accepted3/32ms2740 KiB
6Partially correct1/32ms2964 KiB
7Partially correct1/32ms3048 KiB
8Partially correct1/32ms3172 KiB
9Accepted3/32ms3312 KiB
10Partially correct1/32ms3512 KiB
11Accepted3/32ms3560 KiB
12Partially correct1/32ms3684 KiB
13Accepted4/42ms3868 KiB
14Partially correct1/42ms4076 KiB
15Partially correct1/42ms4280 KiB
16Partially correct1/42ms4352 KiB
17Partially correct1/42ms4352 KiB