Skip to content

Instantly share code, notes, and snippets.

@dniku
Last active August 29, 2015 14:17
Show Gist options
  • Save dniku/faf3321b9d272a7dfe8d to your computer and use it in GitHub Desktop.
Save dniku/faf3321b9d272a7dfe8d to your computer and use it in GitHub Desktop.
Problem I from VK wild-card round #1. The language is Picat. This solution fails with WA #18.
import cp.
read_list=List =>
L=[],
Len=read_int(),
foreach(I in 1..Len)
V := read_int(),
L := [V|L]
end,
List=L.
main =>
N = read_int(),
K = read_int(),
V = new_list(N),
V :: 1..N,
V[1] #= 1,
foreach(I in 1..K)
L := read_list(),
all_different([$V[Ind] : Ind in L])
end,
solve([$min(max(V))], V),
foreach(Q in V)
printf("%d ", Q)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment