SK_001 - Rightful Distribution
Akash , the director of the famous Timus Coaching Institute was very happy after the results of the Entrance Examination, and decided to distribute sweets to the students according to their test scores . He shall distribute sweets according to the following conditions :
i) Every student must get atleast one sweet.
ii) A student with higher score gets more number of sweets than all students who scored less than him.
Help Akash to find out the minimum number of sweets that need to be distributed. Since the answer can be very large output it modulo 109 + 7.
The input consists of 3 lines. The first line contains T (1<=T<=10) denoting the number of test cases. The second line consists of a single interger N (1 <= N <= 105) denoting the number of students.
The next line consists of N space separated integers a1,a2,a3...an where ai denotes the test score of the ith student (0<=ai<=109) .
Output a single integer denoting the minimum number of sweets to be distributed by Akash.
2 2 1 2 3 100 200 50
Mind the mod (10^9)+7, cost me 1 WA. Pretty straight forward other than that.Last edit: 2019-08-25 17:44:51