Company: Devrev
Difficulty: medium
Maximum Set Performance You are given two arrays `t` and `r`, each of length `n`. Choose exactly `k` indices to form a set `S`. The performance of `S` is: `sum(t[i] for i in S) * min(r[i] for i in S)`. Return the maximum possible performance. Input Format The first line contains `n`. The second line contains `n` integers `t[1..n]`. The third line contains `n` integers `r[1..n]`. The fourth line contains `k`. Output Format Print the maximum performance. Constraints - `1 <= k <= n <= 100000` - `0 <= t[i], r[i] <= 10^9` - Use 64-bit integers for the answer. Notes The source stated the performance expression but omitted the required size of `S`. This reconstructed version defines `S` to contain exactly `k` indices; otherwise the optimization problem has no unique input contract.