Remember the preparation time s = s + a, Time to leave e, take 3 Time periods are merged into 2 individual
set up basic[n] On behalf of n The total time of students
Let's assume that there is currently an optimal ranking , The first n Students and n + 1 Students' contribution to time is :
best = 2 * ( basic[n - 1] + e[n - 1] + s[n] ) + e[n] + s[n + 1]
Now exchange No n Students and No n + 1 The position of students , The first n Students and n + 1 Students' contribution to time is :
new = 2 * ( basic[n - 1] + e[n - 1] + s[n + 1] ) + e[n + 1] + s[n]
Because the first is the optimal sort , So satisfy best < new, have to s[n] + e[n] < s[n + 1] + e[n + 1]
So according to sum([s, a, e]) You can get the correct sort by sorting
Full marks end