Usually, in such problems, people cross from one shore to another in a boat, and therefore the boat must always be on the shore from which the people start their journey. I read the condition of your problem, and I have a question: do you have a conditional "boat"? Can you cross the border several times in one direction in a row, without returning?
Added 40 minutes later
To make it easier to understand: you need to transport a cart across the border; the cart has two seats, and people, animals, and objects occupy one seat; there must be at least one person in the cart.