标签:str hose nothing ext make http const imp incr
you are given an array and you are asked to make \(k\) elements of it equal after some operations.
you can make one of the following operations:
find the minimum number of operations to make it possible.
this problem involves nothing but implimention. but we can make it elegantly.
let conclusion comes first, our required answer is
\(ans=min((ansl,ansr),ansmid)\) ,where:
most of the times our answer is contributed by \(ansl\) or \(ansr\) except some cases like test case number two given by the host, in which both the minimum and maximum are extremely close as well as the chosen one is in between.
apart from these there are also some tricks here related to the constraints of the applications of each answer, which is amazing to generate or come out.
code designed by BIG BROTHER COW to take a reference:https://codeforces.com/contest/1328/submission/74425585
Make k Equal from Codeforces Round #629 (Div. 3)
标签:str hose nothing ext make http const imp incr
原文地址:https://www.cnblogs.com/reshuffle/p/12588688.html