https://www.luogu.com.cn/record/37727916
# include <iostream>
# include <cmath>
using namespace std;
bool b[1025][1025] = {};
void solve(int a, int b, int c)
{
if (c == 1)
return;
for (int i = a; i <= c / 2; i++)
for (int j = b; j <= c / 2; j++)
b[i][j] = true;
solve(a, b + c / 2, c / 2);
solve(a + c / 2, b, c / 2);
solve(a + c / 2, b + c / 2, c / 2);
}
int main()
{
int n;
cin >> n;
int t = pow(2, n);
solve(1, 1, t);
for (int i = 1; i <= t; i++)
{
for (int j = 1; j <= t; j++)
cout << !b[i][j] << " ";
cout << endl;
}
}