Solved GoodSubset from SRM 632 div 2.