There are N fighters numbered from 1 to N. Each fighter has strength and experience levels. The strength of the ith fighter is A[i] and experience level of ith fighter is B[i].
The fighters want to choose worthy opponents. Thus, the same opponent can be chosen for one or more fighter or can be not chosen at all. It is given that each fighter has to choose at most one opponent.
The ith fighter will choose an opponent with index j such that the following conditions are satisfied (if such opponent exists) • j<i • A[j] <A[i] • B[j] <B[i] The value of competition is defined as sum of experience levels of chosen opponents. Find the maximum possible value of competition modulo 10^9+7.
How will we solve this Question