Editorial for COCI '16 Contest 6 #1 H-indeks
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
When determining the h-index, it is obvious that we need to observe the papers with more citations. Therefore, we first sort the numbers by size, starting with the largest. We iterate over this array respectively (index ) and if the element is larger than or equal to , this means that is a potential h-index (because the scientist has at least papers with a citation score larger than or equal to ). The task comes down to finding the largest such , which is easily solved by storing the solution in an auxiliary variable and updating it while iterating the array.
Comments