1060D: Social Circles

It is one of those greedy problems where you use the extreme value/boundary conditions as the starting points of optimization!!!

Suppose you have the longest LHS, then you need to right the longest RHS to minimize wait, we union the merge, and keep going until we merged all.

1032D: Barcelonian Distance

A, B can either leave, the avenue by x or y axis, so we have 4 choices on top of manhantann distance.

490D: Chocolate

First op: reduce a 2 factor Second operation: increase a 2 factor and then increase 3

So we just reduce the 3 factor to be the same, and then remove the 2 facters. Note that we can not apply the second ops to only 1 side!

993B: Open Communication

The answer has only 9 * 8 * 7 = 504 choices, for each pair, we see if both exist in the set, if there is only 1 possible pair, we know it is good, > 1 uncertain, = 0 , invalid