asim2005's blog

By asim2005, 4 years ago, In English

https://codeforces.net/problemset/problem/412/B

I couldn't understand the logic behind the first tutorial (**not** the bruteforce one). Can anyone help me?

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Consider the array sorted in decreasing order, and it's $$$k^{th}$$$ element speed as $$$x$$$.

As it clearly produces $$$k$$$ indices $$$[0,k-1]$$$ which have speed greater than or equal to answer. there is no reason to consider any value lower than this.

Following, If we increase the speed further, The computer at $$$k^{th}$$$ position will not be able to operate and hence total number of computers will be fall less then $$$k$$$.

Hence, $$$x$$$ is the optimal choice.