Codeforces 1475E: Advertising Agency | C++ Solution & Explanation