Cod sursa(job #200504)

Utilizator ProtomanAndrei Purice Protoman Data 24 iulie 2008 13:20:28
Problema Oras Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <stdio.h>
#include <algorithm>
#define mx 210

using namespace std;

long n;
long a[mx][mx];

int main()
{
	freopen("oras.in","r",stdin);
	freopen("oras.out","w",stdout);
	scanf("%ld", &n);
	for (int i = 1, x = 1; i <= n; i++, x = 1)
		for (int j = i + 1; j <= n; j++)
		{
			a[i][j] = x;
			a[j][i] = x ^ 1;
			x ^= 1;
		}
	if (n == 4)
		printf("-1\n");
	else for (int i = 1; i <= n; i++)
	{
		if (!(n % 2))
		{
			a[n / 2][n] = 0;
			a[n][n / 2] = 1;
		}
		for (int j = 1; j <= n; j++)
			printf("%ld", a[i][j]);
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}