### need help!

I was reading a question and it was
 The fictional World Championship of Formula 7 Drivers 2012 was characterized by exciting races and frequent shifts of driver positions on the leaderboard. Antun has missed most of it because he was training for olympiads in informatics. Now his only consolation are his medals and being the main character in this task. He has a simple question for you COCI contestants: „How many drivers participating in this Championship still had a chance to become Formula 7 World Champion at the start of the final race?” The World Champion is, of course, the driver with the largest point total at the end (after the final race). There are N drivers participating in the Championship. They are all assigned points after each race, including the final one. The winner of the race is awarded N points, the runner-up gets N - 1 points, and so on until the last driver, who gets 1 point. Two drivers cannot finish a race in the same spot. Write a program to calculate, based on the total number of points that each driver has earned before the final race, how many drivers still have a chance to have the largest total after the final race and thus win the Championship. If more than one driver has the same maximum point total, they are all awarded the World Champion title. INPUT The first line of input contains the positive integer N (3 ≤ N ≤ 300 000), the number of drivers participating in the Championship. Each of the following N lines contains a single integer Bi (0 ≤ Bi ≤ 2 000 000, i = 1, ..., N), the number of points that a driver has before the final race. OUTPUT The first and only line of output should contain the requested number of drivers that can still win.

Here is the program for the question but I'm not able to understand it. Mainly line 15 and 20 so it will be very appreciate if you help me to get it.
 ``1234567891011121314151617181920212223`` ``````#include #include #include using namespace std; int a[300000]; bool cmp(int x, int y) { return x > y; } int main () { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", a+i); sort(a, a+n, cmp); int s = 0; int maks = 0; for (int i = 0; i < n; ++i) { s += (a[i] + n >= maks); maks = max(maks, a[i] + i + 1); } printf("%d\n", s); }``````
Reference for std::sort() :

http://www.cplusplus.com/reference/algorithm/sort/

Reference for std::max() :

http://www.cplusplus.com/reference/algorithm/max/

Presumably, whichever textbook or tutorial you found the question in gave some indication as to what these things are?
Topic archived. No new replies allowed.