137162025-01-08 13:48:56Leventusz09Táblajátékcpp17Wrong answer 1/501ms512 KiB
#include <iostream>
#include <bitset>
#include <string>

using namespace std;

void add(bitset<501> &bs, bool n = false) {
	int c = 0;
	if(!n)
		while(true){
			if (bs[c]) {
				bs.reset(c);
				c++;
			}else{
				bs.set(c);
				break;
			}
		}
	else
		while (true){
			if (bs[c]) {
				bs.reset(c);
				break;
			}
			else {
				bs.set(c);
				c++;
			}
		}
}

int main() {
	int K;
	cin >> K;

	int lv = 0;
	bitset<501> p;

	for (int i = 0, s; i < K; i++) {
		cin >> s;
		switch (s){
		case 0:	lv++;	p<<=1;	break;
		case 1:	lv++;	p<<= 1;	p.set(0);  break;
		case 2:	lv--;	p>>= 1;	break;
		case 3: add(p, 1);	break;
		case 4:	add(p);	break;
		}
	}
	for (int i = 500; i >= 0; i--) {
		if (p[i]) {
			cout << p.to_string().substr(500 - i) << "\n";
			return 0;
		}
	}
	cout << 0 << "\n";
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/50
1Wrong answer0/01ms512 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/31ms512 KiB
4Wrong answer0/31ms316 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/31ms508 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/31ms500 KiB
10Wrong answer0/31ms316 KiB
11Wrong answer0/31ms316 KiB
12Wrong answer0/31ms316 KiB
13Wrong answer0/41ms328 KiB
14Wrong answer0/41ms316 KiB
15Wrong answer0/41ms316 KiB
16Wrong answer0/41ms316 KiB
17Partially correct1/41ms316 KiB