全TLE:
#include<bits/stdc++.h>
#define str to_string
using namespace std;
using ll=long long;
const int MAX=1e3+1;
bool mp[MAX][MAX];
void work(int x1,int y1,int x2,int y2){
int bc=x2-x1+1;
if(bc<=1)return;
for(int i=x1;i<bc/2;i++)
for(int j=y1;j<bc/2;j++)
mp[i][j]=true;
work(0,bc/2-1,bc/2-1,bc-1);
work(bc/2,bc/2,bc-1,bc-1);
work(bc/2-1,0,bc-1,bc/2-1);
}
int n;
int main(){
cin>>n;
int bc=int(pow(2,n));
work(0,0,bc-1,bc-1);
for(int i=0;i<bc;i++){
for(int j=0;j<bc;j++)
cout<<(mp[i][j]?0:1)<<' ';
cout<<'\n';
}
return 0;
}