Company: Goldman Sachs_25july
Difficulty: medium
Container Limit Changes A resource manager keeps a log of limit changes for a set of containers. You are given n update records. The i -th record consists of three values: container[i] — the name of a container. timestamp[i] — the time at which an update occurred. limit[i] — the new limit assigned to that container at that time. Each record means: the limit of container[i] was set to limit[i] at time timestamp[i] . For every container, consider its own updates in increasing order of time. Count the number of containers that satisfy both of the following conditions: 1. The container's limit increased at least once compared to a previous update (some update set a strictly larger limit than an earlier update of the same container). 2. The container's limit decreased at least once compared to a previous update (some update set a strictly smaller limit than an earlier update of the same container). The increase and the decrease may occur in any order. Input Format The first line c