Cod sursa(job #575333)

Utilizator AndreiRSStatescu Andrei Rares AndreiRS Data 8 aprilie 2011 10:19:32
Problema Reuniune Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.24 kb
#include <fstream>
using namespace std;
#define DIM 100005
#define DIM2 25//1005

ifstream fi("stup.in");
ofstream fo("stup.out");

int N, M, X, Y, T[DIM], A[DIM2][DIM2], B[DIM2][DIM2], viz[DIM];
int dx[] = {1, 1, 0, -1, -1, 0};
int dy[] = {0, -1, -1, 0, 1, 1};

void fill(int x, int y)
{
	if (!(C[x][y] == 0 && A[x][y] == C1))
		return;
	for (int d = 0; d < 6; d++)
	{
		fill(x + dx[d], y + dy[d]);
		
	}
}

void cit()
{
	int i, j, c, ca;
	fi >> N >> M >> X >> Y;
	for (i = 1, c = 0; i <= M; i++)
	{
		ca = c;
		fi >> c;
		for (j = ca + 1; j <= c; j++)
			T[j] = i;
	}
}	

void build()
{
	int d, k, j, i = 1, x = DIM2/2, y = DIM2/2;
	A[x][y] = i = 1;
	for (k = 1; i <= N; k++)
		for (d = 0; d < 6 && i <= N; d++)
		{
			j = 1;
			if (d == 1)
				j = 2;
			for (; j <= k && i <= N; j++)
			{
				x += dx[d];
				y += dy[d];
				B[x][y] = ++i;
				A[x][y] = T[i];
				if (i == X)
					Sx = x, Sy = y;
				if (i == Y)
					Fx = x; Fy = y;
			}
		}	
}

void coada()
{
	int x, y;
	C[0][0] = Sx;
	C[0][1] = Sy;
	
	while (p <= u)
	{
		x = C[p][0], y = C[p][1];
		Ct = A[x][y];
		Cd = L[p];
		
		fill(x, y);
		
		
		
		
		
	}
}

int main()
{
	cit();
	build();
	coada();
	
	return 0;
}