54232023-05-17 10:42:38TortelliniJrTáblajátékcpp17Wrong answer 23/503ms4072 KiB

#include <iostream>
#include <vector>
#include <array>
#include <cmath>
#include <string>

using namespace std;

int main()
{
    int n, s, o, j;
	o = 0;
	s = 0;
    cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> j;
		switch (j)
		{
		case 0:
			s++;
			o *= 2;
			break;
		case 1:
			s++, o *= 2, o++;
			break;
		case 2:
			s--;
			o = ceil((double)o / 2);
		case 3:
			o--;
		case 4:
			o++;
		}
	}
	string t;
	if (o == 0)
	{
		t = "0";
	}
	while (o != 0)
	{
		t = to_string(o % 2) + t;
		o /= 2;
	}
	cout << s << endl;
	cout << t << endl;
}
SubtaskSumTestVerdictTimeMemory
base23/50
1Accepted0/03ms1748 KiB
2Wrong answer0/03ms1936 KiB
3Accepted3/33ms2152 KiB
4Accepted3/33ms2360 KiB
5Accepted3/33ms2572 KiB
6Partially correct1/33ms2780 KiB
7Partially correct1/33ms2996 KiB
8Partially correct1/33ms3232 KiB
9Partially correct1/33ms3448 KiB
10Partially correct1/33ms3468 KiB
11Accepted3/33ms3592 KiB
12Partially correct1/33ms3676 KiB
13Partially correct1/43ms3672 KiB
14Partially correct1/43ms3684 KiB
15Partially correct1/43ms3672 KiB
16Partially correct1/43ms3796 KiB
17Partially correct1/43ms4072 KiB