codeforces/672C_bottles.py
def calculate(self):
        """ Main calcualtion function of the class """

        distt = [self.hyp(self.numa[i] - self.tx, self.numb[i] - self.ty)
                 for i in range(self.n)]
        dista = [self.hyp(self.numa[i] - self.ax, self.numb[i] - self.ay)
                 for i in range(self.n)]
        distb = [self.hyp(self.numa[i] - self.bx, self.numb[i] - self.by)
                 for i in range(self.n)]
        distamt = [dista[i] - distt[i] for i in range(self.n)]
        distbmt = [distb[i] - distt[i] for i in range(self.n)]

        min1, min1i = self.minn(distamt)
        min2, min2i = self.minn(distbmt, skipi=set([min1i]))
        result1 = (sum(distt)*2 + min1 +
                   (0 if min2 is None or min2 > 0 else min2))

        min1, min1i = self.minn(distbmt)
        min2, min2i = self.minn(distamt, skipi=set([min1i]))
        result2 = (sum(distt)*2 + min1 +
                   (0 if min2 is None or min2 > 0 else min2))

        return str(min(result1, result2))
 Main calcualtion function of the class 
Main calcualtion function of the class
Main calcualtion function of the class
def calculate(self):
        distt = [self.hyp(self.numa[i] - self.tx, self.numb[i] - self.ty)
                 for i in range(self.n)]
        dista = [self.hyp(self.numa[i] - self.ax, self.numb[i] - self.ay)
                 for i in range(self.n)]
        distb = [self.hyp(self.numa[i] - self.bx, self.numb[i] - self.by)
                 for i in range(self.n)]
        distamt = [dista[i] - distt[i] for i in range(self.n)]
        distbmt = [distb[i] - distt[i] for i in range(self.n)]
        min1, min1i = self.minn(distamt)
        min2, min2i = self.minn(distbmt, skipi=set([min1i]))
        result1 = (sum(distt)*2 + min1 +
                   (0 if min2 is None or min2 > 0 else min2))
        min1, min1i = self.minn(distbmt)
        min2, min2i = self.minn(distamt, skipi=set([min1i]))
        result2 = (sum(distt)*2 + min1 +
                   (0 if min2 is None or min2 > 0 else min2))
        return str(min(result1, result2))
def calculate ( self ) : distt = [ self . hyp ( self . numa [ i ] - self . tx , self . numb [ i ] - self . ty ) for i in range ( self . n ) ] dista = [ self . hyp ( self . numa [ i ] - self . ax , self . numb [ i ] - self . ay ) for i in range ( self . n ) ] distb = [ self . hyp ( self . numa [ i ] - self . bx , self . numb [ i ] - self . by ) for i in range ( self . n ) ] distamt = [ dista [ i ] - distt [ i ] for i in range ( self . n ) ] distbmt = [ distb [ i ] - distt [ i ] for i in range ( self . n ) ] min1 , min1i = self . minn ( distamt ) min2 , min2i = self . minn ( distbmt , skipi = set ( [ min1i ] ) ) result1 = ( sum ( distt ) * 2 + min1 + ( 0 if min2 is None or min2 > 0 else min2 ) ) min1 , min1i = self . minn ( distbmt ) min2 , min2i = self . minn ( distamt , skipi = set ( [ min1i ] ) ) result2 = ( sum ( distt ) * 2 + min1 + ( 0 if min2 is None or min2 > 0 else min2 ) ) return str ( min ( result1 , result2 ) )
Main calcualtion function of the class
Main calcualtion function of the class
""" Main calcualtion function of the class """
self