757C: Felicity is Coming (!!!)

Key question: how to detect that across groups, the 2 types should be in the same permutation?

Answer: if and only we compare the groups in which the type appears, they should be exactly same

Therefore, for each type, we have its group appearances, sort them, and scan through the while keep track of each group

760D: Travel Card (!!!)

Implementation details to watch out for

1. When try expanding the suffix, handle the case where the next digit is 0

2. If the longest suffix is just 0

3. We have to limit the length of suffix. Otherwise, the result will overflow

4. Use a temp index to try the longest suffix, so we can update the state/result only when we have discovered better result

Easy problem, but there is a bug in my code that I was not able to fix it within 10 mins

What I did wrong during contest

  1. should use upper_bound() on vector or sets , instead of implementing my own bsearch

  2. Alternatively, should do bottom-up construction, so that we can update pointers to either neighbors in a while loop => added only linear cost