#include<bits/stdc++.h>
using namespace std;
/*----------------------------------------PBDS-----------------------------------------*/
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//template<typename T> using indexed_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*-------------------------------------------------------------------------------------
*/
/*----------------------------------------MACROS---------------------------------------*/
#define fs first
#define se second
#define ll long long
#define pb push_back
#define ppb pop_back
#define nl (string)"\n"
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sortall(x) sort(all(x))
#define rsort(x) sort(rall(x))
#define mp(x,y) make_pair(x,y)
#define prec(n) fixed<<setprecision(n)
#define fra(i, x) for (auto &i : x)
#define fr(i, x, y) for (int i = (int)x; i < (int)y; ++i)
#define frr(i, x, y) for (int i = (int)x; i >= (int)y; --i)
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<bool> vb;
typedef vector<string> vs;
/*-------------------------------------------------------------------------------------*/
/*--------------------------------------DEGUG------------------------------------------*/
#ifndef ONLINE_JUDGE
#define debug(x...) cout << #x<<" = "; wrt(x); wrt();
#define ____divider____ cout << "-------output-------\n"
#else
#define debug(x...)
#define ____divider____
#endif
/*-------------------------------------------------------------------------------------*/
/*---------------------------------------I/O-------------------------------------------*/
void read() { return; }
void wrt() { cout << nl; }
void wrt(ll t) {cout << t ;}
void wrt(int t) {cout << t ;}
void wrt(char t) {cout << t ;}
void wrt(string t) {cout << t ;}
void wrt(double t) {cout << t ;}
template <class T> void wrt(set <T> v);
template <class T> void wrt(vector <T> v);
template <class T> void wrt(multiset <T> v);
template <class T, class V> void wrt(map <T, V> v);
template <class T, class V> void wrt(pair <T, V> p);
template <size_t T> void wrt(const char (&a)[T]) { string s=a; wrt(s); wrt(); }
template <class T> void wrt(set <T> v) { for (T i : v) {wrt(i); wrt(' ');} wrt(); }
template <class T> void wrt(vector <T> v) { for (T i : v) {wrt(i); wrt(' ');} wrt(); }
template <class T> void wrt(multiset <T> v) { for (T i : v) {wrt(i); wrt(' ');} wrt(); }
template <class T, class V> void wrt(map <T, V> v){for(auto i:v){wrt(i);wrt(' ');}wrt();}
template <class T, class V> void wrt(pair <T, V> p){wrt(p.fs); wrt(' ');wrt(p.se);wrt();}
template <class T, class... V> void wrt(T x, V... args){(wrt(x), wrt(' '),wrt(args...));}
template <class T, class... V> void read(T &x, V &...args) { ((cin >> x),read(args...));}
template <class T> void readArr(T &arr, int x, int y) { fr(i, x, y) cin >> arr[i]; }
template <class T> void wrtArr(T &arr, int x, int y){fr(i, x, y)cout<<arr[i]<<' ';wrt();}
/*-------------------------------------------------------------------------------------*/
/*----------------------------------------CONST----------------------------------------*/
//int MOD = 0;
const int N = 2e5+7;
const int INF = 2e9;
//const ll INF = 2e15;
const int MOD = 1e9+7;
//const int MOD = 998244353;
const double PI = 3.14159265358979312;
const int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // {x, y}
/*-------------------------------------------------------------------------------------*/
/*----------------------------------------FUNCT----------------------------------------*/
template<class T> ll _sum(vector<T>& arr) { return accumulate(all(arr), 0ll); }
template<class T> bool _min(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool _max(T &a, T b) { return a < b ? (a = b, true) : false; }
ll _bits(ll x) { ll cnt = 0; while(x>0) { cnt++; x>>=1; } return cnt; }
ll _setbits(ll x) { ll cnt = 0; while(x>0) { if(x&1) cnt++; x>>=1; } return cnt;}
ll _gcd(ll a, ll b) { return (b == 0) ? (a) : (_gcd(b, a %= b)); }
ll _lcm(ll a, ll b) { if (a < b) swap(a, b); return a / _gcd(a, b) * b; }
ll _add(ll x, ll y) { x %= MOD, y %= MOD; return (x + y) % MOD; }
ll _sub(ll x, ll y) { x %= MOD, y %= MOD; return (x - y + MOD) % MOD; }
ll _mul(ll x, ll y) { x %= MOD, y %= MOD; return (x * 1ll * y) % MOD; }
ll _pow(ll x, ll y) { if (y == 0) return 1; else if (y % 2 == 0){
ll _tmp=_pow(x, y / 2); return _mul(_tmp, _tmp);} else return _mul(x, _pow(x, y - 1));}
ll _inv(ll p) { return _pow(p, MOD - 2); }
ll _div(ll x, ll y) { x %= MOD, y %= MOD; return _mul(x, _inv(y)); }
ll _nCr(ll n, ll r, vl & fact){ return _mul(fact[n], _inv(_mul(fact[r], fact[n - r])));}
/*-------------------------------------------------------------------------------------*/
/*----------------------------------------MAIN-CODE------------------------------------*/
void solveTestCase(int test_case){
int n, a, b; read(n, a, b);
if(n==2 && a==1 && b==1) return wrt("NO");
if(n==3 && a==1 && b==1) return wrt("NO");
if(a>1){
if(b==1){
wrt("YES");
vs ans(n, string(n, '0'));
fr(i, a-1, n){
fr(j, i+1, n) ans[i][j]=ans[j][i]='1';
}
wrt(ans);
}else{
wrt("NO");
}
}else{
wrt("YES");
vs ans(n, string(n, '0'));
if(b==1){
fr(i, 0, n-1) ans[i][(i+1)%n]=ans[(i+1)%n][i]='1';
}else{
fr(i, 0, b-1){
fr(j, 0, n) ans[i][j]=ans[j][i]='1';
}
}
fr(i, 0, n) ans[i][i]='0';
wrt(ans);
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
____divider____;
int test_cases=1;
// cin>>test_cases;
for(int t=1; t<=test_cases; t++)
solveTestCase(t);
return 0;
}
2099. Find Subsequence of Length K With the Largest Sum | 1608A - Find Array |
416. Partition Equal Subset Sum | 1446. Consecutive Characters |
1618A - Polycarp and Sums of Subsequences | 1618B - Missing Bigram |
938. Range Sum of BST | 147. Insertion Sort List |
310. Minimum Height Trees | 2110. Number of Smooth Descent Periods of a Stock |
2109. Adding Spaces to a String | 2108. Find First Palindromic String in the Array |
394. Decode String | 902. Numbers At Most N Given Digit Set |
221. Maximal Square | 1200. Minimum Absolute Difference |
1619B - Squares and Cubes | 1619A - Square String |
1629B - GCD Arrays | 1629A - Download More RAM |
1629C - Meximum Array | 1629D - Peculiar Movie Preferences |
1629E - Grid Xor | 1629F1 - Game on Sum (Easy Version) |
2148. Count Elements With Strictly Smaller and Greater Elements | 2149. Rearrange Array Elements by Sign |
2150. Find All Lonely Numbers in the Array | 2151. Maximum Good People Based on Statements |
2144. Minimum Cost of Buying Candies With Discount | Non empty subsets |