CSES - Datatähti 2017 alku - Results
Submission details
Task:Bittijono
Sender:ankka22
Submission time:2016-10-04 23:19:07 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:6:21: error: variable-sized object 'bits' may not be initialized
  bool bits[len] = {0};
                     ^

Code

#include <iostream>
#include <bitset>
int main() {
	int len = 1500;
	//std::cout << "heiisdfi" << std::endl;
	bool bits[len] = {0};
	bits[0] = 0;
	bits[1] = 1;
	int currentLength = 4;
	int n = 2;
	while (1) {
		bits[n] = !bits[n - currentLength / 2];
		n++;
		if (currentLength == n) {
			currentLength *= 2;
		}
		if (currentLength > len) {
			break;
		}
	}
	int v[100000];
	std::cin >> n;
	int cur;
	for (int i = 0; i < n; i++) {
		std::cin >> cur;
		v[i] = bits[cur % 576];
	}
	for (int i = 0; i < n; i++) {
		std::cout << v[i];
	}
	//576
	/*int thisRow = 0;
	int perRow = 8;

	bool newRow = true;

	int row = 1;
	int thisBlock = 24;
	int perBlock = 25;
	for (int i = 0; i < len; i++) {

			if (newRow) {
				std::cout << row << " ";
				newRow = false;
			}
		std::cout << bits[i];

		if ((i+1) % 4 == 0) {
			std::cout << " ";
			thisRow++;
			if (thisRow == perRow) {
				std::cout << std::endl;
				thisRow = 0;
				row++;
				newRow = true;
			}
		}
	}
	std::cout << "599" << bits[600];
	std::cout << std::endl;*/
	return 0;
}
//01101001100101101001011001101001100101100110100101101001100101101001011001
//01101001100101101001011001101001
/*
Syöte:
3
5
2
7

Tuloste:
1
1
0
*/