Pagini recente » Cod sursa (job #3160641) | Cod sursa (job #967734) | Cod sursa (job #2555585) | Cod sursa (job #78925) | Cod sursa (job #989385)
Cod sursa(job #989385)
#include <fstream>
#include <vector>
#include <bitset>
#include <queue>
#include <algorithm>
#include <utility>
#include <cstring>
#include <string>
#include <stack>
#include <deque>
#include <iomanip>
#include <set>
#include <map>
#include <cassert>
#include <ctime>
#include <list>
#include <iomanip>
using namespace std;
string file = "oras";
ifstream cin( (file + ".in").c_str() );
ofstream cout( (file + ".out").c_str() );
const int MAXN = 205;
const int oo = (1<<31)-1;
typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;
const inline int min(const int &a, const int &b) { if( a > b ) return b; return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b; return a; }
const inline void Get_min(int &a, const int b) { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b) { if( a < b ) a = b; }
struct ClassComp {
inline bool operator () (const int &a, const int &b) const {
return a > b;
}
};
bool G[MAXN][MAXN];
inline void BuildGraph(int N) {
if(N == 3) {
G[1][2] = G[2][3] = G[3][1] = 1;
return;
}
if(N == 6) {
G[1][2] = G[1][3] = G[1][4] = 1;
G[2][3] = G[2][4] = G[2][5] = 1;
G[3][4] = G[3][6] = 1;
G[4][5] = G[4][6] = 1;
G[5][1] = G[5][3] = G[5][6] = 1;
G[6][1] = G[6][2] = 1;
return;
}
for(int i = 1 ; i <= N - 2; ++ i)
G[i][N-1] = G[N][i] = 1;
G[N-1][N] = 1;
BuildGraph(N-2);
}
int main() {
int N;
cin >> N;
if(N == 4) {
cout << "-1\n";
return 0;
}
BuildGraph(N);
for(int i = 1 ; i <= N ; ++ i, cout << '\n')
for(int j = 1 ; j <= N ; ++ j)
cout << G[i][j];
cin.close();
cout.close();
return 0;
}