Why don't you just try?
You have a working solution and it is not too difficult to create random I/O for this problem and test your alternative, greedy solution if the judge says it fails.
Not all problems have to be spoiled by strong hints and/or critical I/O in the forum. There is room for people to be creative themselves.
There is also a dp solution but it is probably slower than backtracking. The observation is that if we have >=3 people to choose from, then we can try to choose the highest first (greedy), but the choice of the second and third person of the team are not greedy. It is not hard to come up with examples that illustrates this.
is it that ppl who solved it in less than 1s or .002 sec have solved it using backtracking..
I myself solve it using dp... more apt would be memoization...
I takes >1s ,precisely 1.094..
If I will myself do hashing, then who will do coding !!!
vinay wrote:is it that ppl who solved it in less than 1s or .002 sec have solved it using backtracking..
I myself solve it using dp... more apt would be memoization...
I takes >1s ,precisely 1.094..
I tried it using back-tracking, and DP like O(2^n), but I got TLE
I want to show your solution - that is, how to solve it using back-tracking... or memoization