cpp implementation of N Queens II