The problem does not indicate if there could be duplicated number in the list or not? if there are, most of the solutions to use dict should not work since they use the list value as the dict key.
Actually you're right. Most of solutions does not handle case when input array contains duplicates, but to handle such situation you need just to use
std::multimap::equal_range. And it will not decrease performance cause you should return first pair of not equal indices.