Editorial for DMOPC '20 Contest 6 P1 - Tug of War
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
The only possible splitting point is between the two students, so all we have to do is output
Time Complexity:
Subtask 2
Consider an imaginary splitting point, starting between the first two students. As we move this splitting point to the right, the sum of strengths of the left side will increase and the sum of strengths of the right side will decrease. All we have to do is find their "intersection point" (since I've been cramming too much economics recently, think
Time Complexity:
Subtask 3
For full marks, we can extend the idea above to work in
It is worth noting that binary searching for the optimal splitting point with a prefix sum data structure is also sufficient to pass in
Time Complexity:
Comments