@MartinJaniczek (⊢+.+⌊/) is the sum of the fastest person's time added to each time, but then we've counted the smallest time 3 times too much; 2 times because they don't need to accompany themselves, and 1 because they don't need to come back after accompanying the last friend, so -3×⌊/ subtracts 3 times the smallest element.
Ah, I just had to parenthesize your expression before applying it to the array 1 2 5 10. Gotcha. No, that algorithm isn't optimal. It's the one I arrived at in my head, yeah!
Just to be explicit (with spoiler prevention), the optimal solution AFAIK is 3-⍨+/2/⍳4
I think I could describe an algorithm to get at it programmatically (that isn't a bruteforce search) but I don't think coding that up is worth it when bruteforce works so well for input this small :)
(the above is with ⎕IO 1, I should have obfuscated it differently)
@MartinJaniczek I don't get it. For every 2-way trip (because the torch needs to come back), effectively only one person crosses, because one of the 2 has to bring the torch back, so the total time is the sum of all crossing times. Except the last trip, where effectively the last 2 people are crossing together and nobody needs to come back. The return-leg is wasted, so the fastest person should do it, adding n-3 fastest-person return-legs. Am I reasoning wrong here?
lol, aside from being an interesting paper, I like how they have to declare they don't have a conflict of interest, as if they could be paid by a torch company to promote nonoptimal solutions to increase profit