33152023-02-25 08:53:27horvathabelTáblajátékcpp17Partially correct 36/503ms3484 KiB
#include <bits/stdc++.h>
using namespace std;
string kettes(int x){
	string mego="";
    
	if (x==0) mego+="0";
	while (x>0){
		mego+=to_string(x%2);
		x=x/2;
	}
	reverse(mego.begin(), mego.end());
	return (mego);
}
int main() {
	int n;
	cin>>n;
	pair<int, int> os={0,0};
	for (int i=0; i<n;i++){
		int k;
		cin>>k;
		if (k==0){
			os.first++;
			os.second=os.second*2;
		}
		if (k==1){
			os.first++;
			os.second=os.second*2+1;
		}	
		if (k==2){
			os.first--;
			os.second=os.second/2;
		}
		if (k==3){
			os.second--;
		}
		if (k==4){
			os.second++; 
		}
		} 
		cout<<os.first<<endl<<kettes(os.second); 

}
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/03ms1812 KiB
2Accepted0/03ms2056 KiB
3Accepted3/33ms2272 KiB
4Accepted3/33ms2484 KiB
5Accepted3/33ms2564 KiB
6Partially correct1/33ms2640 KiB
7Accepted3/33ms2892 KiB
8Partially correct1/33ms2972 KiB
9Accepted3/33ms3124 KiB
10Partially correct1/33ms3116 KiB
11Accepted3/33ms3324 KiB
12Partially correct1/33ms3320 KiB
13Accepted4/43ms3356 KiB
14Partially correct1/43ms3356 KiB
15Accepted4/43ms3356 KiB
16Partially correct1/43ms3356 KiB
17Accepted4/43ms3484 KiB