Ya me parecía a mí que no salía ni a tiros cuando lo intentaba hacer de forma normal.
Así que he hecho este pequeño programa en Free Pascal y me dice que no hay ninguna solución. El programa funciona, ya que ha bastado que quitara alguna de la condiciones para que salieran respuestas, luego lo que sucede es que el pasatiempo este no tiene solución.
program logica;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
type
cuatro = array[1..4] of string;
cuatronum = array[1..4] of integer;
permu = array[1..24] of cuatronum;
const
permus:permu=((1,2,3,4),(1,2,4,3),(1,3,2,4),(1,3,4,2),(1,4,2,3),(1,4,3,2),
(2,1,3,4),(2,1,4,3),(2,3,1,4),(2,3,4,1),(2,4,1,3),(2,4,3,1),
(3,1,2,4),(3,1,4,2),(3,2,1,4),(3,2,4,1),(3,4,1,2),(3,4,2,1),
(4,1,2,3),(4,1,3,2),(4,2,1,3),(4,2,3,1),(4,3,1,2),(4,3,2,1));
nombres:cuatro=('osvaldo','carlos','marcelo','eduardo');
Apellidos:cuatro=('gonzalez','dominguez','alvarez','ocampo');
nacion:cuatro=('uruguay','colombia','españa','argentina');
estado:cuatro=('casado','soltero','viudo','divorciado');
profesion:cuatro=('ingeniero','abogado','educador','escritor');
var
i,j,k,m,n:integer;
tabla: array[1..6] of cuatro;
vale:boolean;
begin
tabla[1]:= apellidos;
for i:=1 to 24 do
begin
writeln(i);
for n:=1 to 4 do tabla[2,n]:= nombres[permus[i,n]];
for j:=1 to 24 do
begin
for n:=1 to 4 do tabla[3,n]:= nacion[permus[j,n]];
for k:=1 to 24 do
begin
for n:=1 to 4 do tabla[4,n]:= estado[permus[k,n]];
for m:=1 to 24 do
begin
for n:=1 to 4 do tabla[5,n]:= profesion[permus[m,n]];
vale:=true;
n:=1;
while tabla[5,n]<>'educador' do inc(n,1);
if (tabla[4,n]<>'divorciado') or (tabla[1,n]='gonzalez') then vale:=false;
if vale then
begin
n:=1;
while tabla[4,n]<>'casado' do inc(n,1);
if (tabla[2,n]='carlos') or (tabla[1,n]='dominguez') then vale:=false;
if vale then
begin
n:=1;
while tabla[1,n]<>'alvarez' do inc(n,1);
if (tabla[4,n]<>'soltero') or (tabla[2,n]='marcelo') then vale:=false;
if vale then
begin
n:=1;
while tabla[3,n]<>'colombia' do inc(n,1);
if (tabla[4,n]<>'viudo') or (tabla[2,n]='eduardo') then vale:=false;
if vale then
begin
n:=1;
while tabla[5,n]<>'escritor' do inc(n,1);
if (tabla[4,n]='casado') or (tabla[3,n]='español') then vale := false;
if vale then
begin
n:=1;
while tabla[2,n]<>'osvaldo' do inc(n,1);
if (tabla[1,n]<>'ocampo') or (tabla[3,n]='argentina') then vale:=false;
if vale then
begin
n:=1;
while tabla[2,n]<>'marcelo' do inc(n,1);
if (tabla[4,n]='viudo') then vale:=false;
if vale then
begin
n:=1;
while tabla[3,n]<>'uruguay' do inc(n,1);
if (tabla[1,n]<>'gonzalez') or (tabla[5,n]='abogado') then vale:=false;
if vale then
begin
n:=1;
while tabla[2,n]<>'carlos' do inc(n,1);
if tabla[5,n]<>'ingeniero' then vale:=false;
if vale then
begin
writeln(i,j,k,m);
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
readln;
end.
Y eso es todo.