I came up with a O(n) solution to the problem, can anyone help me prove my hypothesis. I have an intuition for my problem as follows:

for (ll i = 0; i < n; ++i) {

cin >> a >> b >> c;

sum_computers += a;

min_sum_other_tasks = min(min_sum_other_tasks, b + c);

max_sum_total = max(max_sum_total, a + b + c);

}

ll min1 = sum_computers + min_sum_other_tasks;

ll ans = max(min1, max_sum_total);

If we think about the best case of total time, it would be the sum of times of computer required by everyone (this part will remain the same, no matter what the order) and the sum of minimum time required to complete task 2 and task 3.

But there may be a case where even if a person goes first, their time is greater than our assumed above case. So I took a max between them.

What I feel is the test cases were weak so it passed...