Company: Inmobi_4nov
Difficulty: medium
The Last Firewall Problem Description A rogue superintelligent system called Nexus has taken over the network, and Vega, the last remaining hacker, is the only one who can shut it down. Nexus is guarded by an adaptive firewall that weakens whenever a virus packet is injected into it. Each packet, once injected, drains 1 unit of strength per second from the firewall for the following k seconds. The firewall is reactive, though — if it is still draining from an earlier packet when a new one lands, the new packet overwrites the old decay window and starts counting down from scratch. Vega already knows the exact timestamps (in seconds) at which each packet will be fired. The firewall starts with x strength units, and Vega wants the smallest packet strength ( k ) that guarantees the total drain reaches at least x . Help Vega find the least k that guarantees the firewall's collapse? Input Format The first line contains a single integer t (1 <= t <= 1000) the number of testcases. The fi