#include #include #include #include using namespace std; using namespace atcoder; using namespace __gnu_pbds; using ll=long long; using ld=long double; using vll=vector; using vvll=vector; using pll=pair; // using mint=modint; // template // using ordered_map=tree,rb_tree_tag,tree_order_statistics_node_update>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //各段を横3マスずつ分けooo|ooo|ooo|...、余った(3k+1)段目の1マスと(3k+2)段目の2マスを1つの三角形にする。 //どちらの3マス組も全て1にはできないため、各組に少なくとも1つ2以上が必要。 //よって、下界はT+floor(T/2)です(T=N(N+1)/2)。 //マスを (i+j) mod 3 で3彩色し、1色だけ2、他を1にすれば //各三角形は必ず {1,1,2} となり、この下界を達成できる。 ll N; cin>>N; for(int i=1;i<=N;++i){ for(int j=1;j<=i;++j){ if(j)cout<<' '; if((i+j)%3)cout<<1; else cout<<2; } cout<<'\n'; } }