I completely missed the naive solution to iterate off here because I didn't realize that order didn't matter.
The solution for the first subtask was simply to build all 2^N sets and answer based on which ones ended up in the right spot.
The solution for the second subtask was the same as the first, except by dividing into 2 parts, which led to a bunch of other thorny complications.
Last updated 1 year ago