this repo has no description
at develop 634 B view raw
1% Tamaño del cuadrado latino. 2int: n; 3array[1..n,1..n,1..n] of var bool: a; 4 5predicate atmostone(array[int] of var bool:x) = 6 forall(i,j in index_set(x) where i < j)( 7 (not x[i] \/ not x[j])); 8predicate exactlyone(array[int] of var bool:x) = 9 atmostone(x) /\ exists(x); 10 11constraint forall(i,j in 1..n)( 12 exactlyone(k in 1..n)(a[i,j,k]) /\ 13 exactlyone(k in 1..n)(a[i,k,j]) /\ 14 exactlyone(k in 1..n)(a[k,i,j]) 15 ); 16solve satisfy; 17output [ if fix(a[i,j,k]) then 18 show(k) ++ if j == n then "\n" else " " endif 19 else "" endif | i,j,k in 1..n ];