Cod sursa(job #200503)

Utilizator ProtomanAndrei Purice Protoman Data 24 iulie 2008 13:19:44
Problema Oras Scor 65
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 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[3][6] = 0;
			a[6][3] = 1;
		}
		for (int j = 1; j <= n; j++)
			printf("%ld", a[i][j]);
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}