CSES - Datatähti 2018 peili - Results
Submission details
Task:Merkkijono
Sender:367535629127093
Submission time:2017-10-10 16:26:06 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1--details
#2--details
#3--details
#4--details
#5--details
#6--details
#7--details
#8--details
#9--details
#10--details

Code

#include <bits/stdc++.h>

using namespace std;

int n;

inline int subsqcnt(unsigned int asd) {
	if(asd==0)
		return 1;
	else if(asd==1)
		return 2;
	else 
		return subsqcnt(asd-2) + subsqcnt(asd-1) + 1;
}
inline int uniqsubBIT(bitset<32> bs, int length) {
	bs = bs.flip();
	int yk = 1;
	int nl = 0;
	int count = 2;
	int prev;
	for(int i=length-2; i>=0; i--) {
		prev = count;
		count *= 2;
		if(bs[i]==false) {
			count -= nl;
			nl = prev;
		} else {
			count -= yk;
			yk = prev;
		}
	}
	return count;
}

int main() {
	cin >> n;
	int bp = 1;
	for(int i=0; i<n; i++) {
		bp = i;
		if(subsqcnt(i)-1>=n)
			break;
	}
	einain:
	int ff = pow(2, bp)/2;
	for(int i=0; i<ff; i++) {
		if(i%32==0&&__builtin_popcount(i)==1&&i>2){
		se:
				int fhj = i;
				int huhu=1;
				while(fhj>=2) {
					fhj/=2;
					huhu++;
				}
				int verytemp =(4*pow(2,huhu)-3-(-pow(-1,huhu)))/6+1;
				bitset<32> bst(verytemp);
				if(uniqsubBIT(bst, bp)-1<n) {
					i = pow(2, huhu);
					continue;
				}
			}
		bitset<32> bs(i);
		int nnnnnn = uniqsubBIT(bs, bp);
		if(nnnnnn-1 == n) {
			cout << bs.to_string().substr(32-bp);
			return 0;
		}
		if(nnnnnn*2<n) { /// ei kai toimi
			i++;
			if(i%32==0&&__builtin_popcount(i)==1&&i>2)	
				goto se;
		}
	}
	bp++;
	goto einain;
}

Test details

Test 1

Verdict:

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
(empty)

Test 2

Verdict:

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
(empty)

Test 3

Verdict:

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
(empty)

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
(empty)

Test 5

Verdict:

input
ACDCBBACDBBBACAACBBDBADBAABABA...

correct output
ACDCACDADBADABACACDCADADABABCA...

user output
(empty)

Test 6

Verdict:

input
EETFHIJOGACDHMGVFJCMETMZDEITTR...

correct output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

user output
(empty)

Test 7

Verdict:

input
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB...

correct output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

user output
(empty)

Test 8

Verdict:

input
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS...

correct output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

user output
(empty)

Test 9

Verdict:

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
(empty)

Test 10

Verdict:

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
(empty)