#include #include #include #include using namespace std; int main() { int n; cin >> n; vector> table(n+1); for (int i = 1; i <= n; i++) { vector> v; int rt = static_cast(sqrt(i)); for (int j = 1; j <= rt; j += 2) { v.emplace_back(make_pair(j, j + table[i - j * j].second)); } for (int j = rt - rt % 2; j > 0; j -= 2) { v.emplace_back(make_pair(j, j + table[i - j * j].second)); } int k = distance(v.begin(), min_element(v.begin(), v.end(), [](auto a, auto b) { return a.second < b.second; })); table[i].first = v[k].first; table[i].second = table[i].first + table[i - table[i].first * table[i].first].second; } bool b = 0; for (int i = n; i > 0; i -= table[i].first*table[i].first) { for (int j = 0; j < table[i].first; j++) { cout << b; b ^= 1; } b ^= 1; } return 0; }